SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

IS-H HCM Communication Viewer



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> HR
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Mon Feb 25, 2008 12:57 pm    Post subject: IS-H HCM Communication Viewer Reply with quote

Code:
report zcen_ish_hcm_viewer no standard page heading

****************************************************
*  IS-H HCM Message/Segment Customizing Viewer

*   Version 1.00
*   This report shows the customizing of Messages, Segments
*   and fields in a simple tree. Only upload of this report
*   is required. No Dynpro and CUA Status has to be maintained.

*   This is freeware. Please read the terms of use.
*   Written by Urs Rohner, Rohner IT Consulting & Engineering

*   Contact Author: Urs Rohner
****************************************************
*
* G L O B A L S
*

  class lcl_application definition deferred.
  class cl_gui_cfw definition load.

  types:
    t_node_e          type treemsnode,
    t_node            type standard table of t_node_e
                        with default key.
  constants:
    c_root            type t_node_e-node_key value 'RT00001'.

  data:
    _return_code      type i,
    _application      type ref to lcl_application,
    _custom_container type ref to cl_gui_docking_container,
    _tree             type ref to cl_gui_simple_tree.


  types:
    " Message Fields
    begin of t_tncf_e,
      tncf0           type tncf0,
      tncf1           type tncf1,
    end of t_tncf_e,
    t_tncf            type t_tncf_e occurs 0.

  types:
    " Assignment Segments/Fields
    begin of t_tncsf_e,
      nodekey         type t_node_e-node_key,
      tncs2           type tncs2,
      tncf            type t_tncf_e,
    end of t_tncsf_e,
    t_tncsf           type t_tncsf_e occurs 0.

  types:
    " Message Segments
    begin of t_tncs_e,
      tncs0           type tncs0,
      tncs1           type tncs1,
      tncsf           type t_tncsf,
    end of t_tncs_e,
    t_tncs            type t_tncs_e occurs 0.

  types:
    " Assignment Message Types/Segments
    begin of t_tncts_e,
      nodekey         type t_node_e-node_key,
      tnct2           type tnct2,
      tncs            type t_tncs_e,
    end of t_tncts_e,
    t_tncts           type t_tncts_e occurs 0.

  types:
    " Message Types
    begin of t_tnct_e,
      nodekey         type t_node_e-node_key,
      tnct0           type tnct0,
      tnct1           type tnct1,
      tncts           type t_tncts,
    end of t_tnct_e,
    t_tnct            type t_tnct_e occurs 0.

  types:
    " Communication Standards
    begin of t_tncstd_e,
      nodekey         type t_node_e-node_key,
      tncst           type tncst,
      tncsu           type tncsu,
      tnct            type t_tnct,
    end of t_tncstd_e,
    t_tncstd type t_tncstd_e occurs 0.

  data:
    " HCM data
    _tncsf            type t_tncsf,
    _tncf             type t_tncf,
    _tncts            type t_tncts,
    _tncs             type t_tncs,
    _tnct             type t_tnct,
    _tncstd           type t_tncstd.


*
* S E L E C T I O N   S C R E E N
*
  parameter:
    _event            type text30,
    _node             type tv_nodekey.


*
* L C L _ A P P L I C A T I O N   D E F I N I T I O N
*
  class lcl_application definition.
    public section.
      methods:
        handle_node_double_click
          for event node_double_click
          of cl_gui_simple_tree
          importing node_key,
        handle_expand_no_children
          for event expand_no_children
          of cl_gui_simple_tree
          importing node_key.
  endclass.


*
* L C L _ A P P L I C A T I O N   I M P L E M E N T A T I O N
*
  class lcl_application implementation.
    method  handle_node_double_click.
      _event = 'NODE_DOUBLE_CLICK'.
      _node  = node_key.
    endmethod.

    method handle_expand_no_children.
      data:
        _nodes type t_node,
        _node  type t_node_e.

      _event = 'EXPAND_NO_CHILDREN'.
      _node = node_key.
    endmethod.
  endclass.



*
* P B O ( )
*
  initialization.
    perform m_get_tncstd using
      sy-langu
      _tncsf[]
      _tncf[]
      _tncts[]
      _tncs[]
      _tnct[]
      _tncstd[].

    create object _application.
    perform m_create_and_init_tree using c_root _tncstd[].



*
* A T   S E L E C T I O N   S C R E E N   O U T P U T
*
  at selection-screen output.
    loop at screen.
      case screen-name+0(1).
        when '_'.
          screen-input = '0'.
          modify screen.
      endcase.
    endloop.



*
* A T   S E L E C T I O N   S C R E E N
*
  at selection-screen.
    call method cl_gui_cfw=>dispatch
      importing return_code = _return_code.
    if _return_code ne cl_gui_cfw=>rc_noevent.
      " a control event occured, exit PAI
      exit.
    endif.



*
* P A I ( )
*
  start-of-selection.




*
* F O R M S
*

  form m_create_and_init_tree using
    value(root_) type t_node_e-node_key
    tncstd_      type t_tncstd.

    data:
      _repid     type sy-repid,
      _dynnr     type sy-dynnr.

    data:
      _node      type t_node,
      _events    type cntl_simple_events,
      _event     type cntl_simple_event.

    _repid = sy-repid.
    _dynnr = sy-dynnr.

    " create a container for the tree control
    create object _custom_container
      exporting
        repid        = _repid
        dynnr        = _dynnr
        extension    = 400.
    " create a tree control
    create object _tree
      exporting
        parent              = _custom_container
        node_selection_mode = cl_gui_simple_tree=>node_sel_mode_single.

    " define the events which will be passed to the backend

    " node double click
    _event-eventid = cl_gui_simple_tree=>eventid_node_double_click.
    _event-appl_event = 'X'.
    append _event to _events[].

    " expand no children
    _event-eventid = cl_gui_simple_tree=>eventid_expand_no_children.
    _event-appl_event = 'X'.
    append _event to _events[].

    call method _tree->set_registered_events
      exporting events = _events[].

    " assign event handlers in application class to each desired event
    set handler _application->handle_node_double_click  for _tree.
    set handler _application->handle_expand_no_children for _tree.

    perform m_build_node_table using root_ _node[] tncstd_[].

    call method _tree->add_nodes
      exporting
        table_structure_name = 'TREEMSNODE'
        node_table           = _node[].

  endform.


* Set Node Key
  define m_set_nodekey>.
    perform m_set_nodekey using &1 &2 &3.
  end-of-definition.

  form m_set_nodekey using
    value(type_) type c
    value(seq_)  type i
    nodekey_     type t_node_e-node_key.

    data:
      _seq(5)    type n.

    _seq = seq_.
    clear nodekey_.
    concatenate type_ _seq into nodekey_.
  endform.


* Get IS-H Communication Customizing
  form m_get_tncstd using
    spras_    type sy-langu  " Text Language
    tncsf_    type t_tncsf   " Assignment Segment/Fields
    tncf_     type t_tncf    " Message Fields
    tncts_    type t_tncts   " Assignment Message Types/Segments
    tncs_     type t_tncs    " Message Segments
    tnct_     type t_tnct    " Message Types
    tncstd_   type t_tncstd. " Communication Standards

    data:
      _tncs2  type tncs2 occurs 0 with header line,
      _tncf0  type tncf0 occurs 0 with header line,
      _tnct2  type tnct2 occurs 0 with header line,
      _tncs0  type tncs0 occurs 0 with header line,
      _tnct0  type tnct0 occurs 0 with header line,
      _tncst  type tncst occurs 0 with header line,
      _tncf   type t_tncf_e,
      _tncsf  type t_tncsf_e,
      _tncs   type t_tncs_e,
      _tncts  type t_tncts_e,
      _tnct   type t_tnct_e,
      _tncstd type t_tncstd_e.

    clear:
      tncsf_[],
      tncf_[],
      tncts_[],
      tncs_[],
      tnct_[],
      tncstd_[].

    " get assignment segment/fields
    select * from tncs2 into table _tncs2[].
    sort _tncs2[].

    " get fields
    select * from tncf0 into table _tncf0[].
    sort _tncf0[].
    loop at _tncf0[] into _tncf0.
      clear _tncf.
      _tncf-tncf0 = _tncf0.
      select single * from tncf1 into _tncf-tncf1
        where spras eq spras_
        and   stand eq _tncf0-stand
        and   stver eq _tncf0-stver
        and   fdnam eq _tncf0-fdnam.
      if not sy-subrc is initial.
        _tncf-tncf1-fdbem = _tncf0-fdnam.
      endif.
      append _tncf to tncf_[].
    endloop.

    " get assignment message types/segments
    select * from tnct2 into table _tnct2[].
    sort _tnct2[].

    " get message segments
    select * from tncs0 into table _tncs0[].
    sort _tncs0[].
    loop at _tncs0[] into _tncs0.
      clear _tncs.
      m_set_nodekey> 'SG' sy-tabix _tnct-nodekey.
      _tncs-tncs0 = _tncs0.
      select single * from tncs1 into _tncs-tncs1
        where spras      eq spras_
        and   stand      eq _tncs0-stand
        and   stver      eq _tncs0-stver
        and   sgownercde eq _tncs0-sgownercde
        and   sgnr       eq _tncs0-sgnr.
      if not sy-subrc is initial.
        _tncs-tncs1-sgbem = _tncs0-sgnr.
      endif.
      loop at _tncs2[] into _tncs2
        where stand      = _tncs0-stand
        and   stver      = _tncs0-stver
        and   sgownercde = _tncs0-sgownercde
        and   sgnr       = _tncs0-sgnr.
        clear _tncsf.
        m_set_nodekey> 'SF' sy-tabix _tncsf-nodekey.
        _tncsf-tncs2 = _tncs2.
        read table tncf_[] into _tncsf-tncf with key
          tncf0-stand = _tncs2-stand
          tncf0-stver = _tncs2-stver
          tncf0-fdnam = _tncs2-fdnam.
        if sy-subrc is initial.
          append _tncsf to tncsf_[].
          append _tncsf to _tncs-tncsf[].
        endif.
      endloop.
      append _tncs to tncs_[].
    endloop.

    " get message types
    select * from tnct0 into table _tnct0[].
    sort _tnct0[].
    loop at _tnct0[] into _tnct0.
      clear _tnct.
      m_set_nodekey> 'MT' sy-tabix _tnct-nodekey.
      _tnct-tnct0 = _tnct0.
      select single * from tnct1 into _tnct-tnct1
        where spras      eq spras_
        and   stand      eq _tnct0-stand
        and   stver      eq _tnct0-stver
        and   ntownercde eq _tnct0-ntownercde
        and   ntnr       eq _tnct0-ntnr.
      if not sy-subrc is initial.
        _tnct-tnct1-ntbem = _tnct0-ntnr.
      endif.
      " add all related messages
      loop at _tnct2[] into _tnct2
        where stand      eq _tnct0-stand
        and   stver      eq _tnct0-stver
        and   ntownercde eq _tnct0-ntownercde
        and   ntnr       eq _tnct0-ntnr.
        clear _tncts.
        m_set_nodekey> 'MS' sy-tabix _tncts-nodekey.
        _tncts-tnct2 = _tnct2.
        read table tncs_[] into _tncts-tncs with key
          tncs0-stand      = _tnct2-stand
          tncs0-stver      = _tnct2-stver
          tncs0-sgownercde = _tnct2-sgownercde
          tncs0-sgnr       = _tnct2-sgnr.
        if sy-subrc is initial.
          append _tncts to tncts_[].
          append _tncts to _tnct-tncts[].
        endif.
      endloop.
      append _tnct to tnct_[].
    endloop.

    " get communication standards
    select distinct * from tncst into table _tncst[].
    loop at _tncst[] into _tncst.
      clear _tncstd.
      m_set_nodekey> 'CS' sy-tabix _tncstd-nodekey.
      _tncstd-tncst = _tncst.
      select single * from tncsu into _tncstd-tncsu
        where spras eq spras_
        and   stand eq _tncst-stand
        and   stver eq _tncst-stver.
      if not sy-subrc is initial.
        _tncstd-tncsu-stbem = _tncst-stand.
      endif.
      " add all message types to communication standard
      loop at tnct_[] into _tnct
        where tnct0-stand eq _tncstd-tncst-stand
        and   tnct0-stver eq _tncstd-tncst-stver.
        append _tnct to _tncstd-tnct[].
      endloop.
      append _tncstd to tncstd_[].
    endloop.
    sort tncstd_[].
  endform.


  define m_extend_nodekey>.
    perform m_extend_nodekey using &1 &2 &1.
  end-of-definition.

  form m_extend_nodekey using
    value(key_)   type t_node_e-node_key
    seq_          type i
    nodekey_      type t_node_e-node_key.

    data:
      _seq(5)     type n.

    add 1 to seq_.
    _seq = seq_.
    nodekey_ = key_.
    nodekey_+7(5) = _seq.
  endform.


  form m_build_node_table using
    value(root_)  type t_node_e-node_key
    node_         type t_node
    tncstd_       type t_tncstd.

    data:
      _node       type t_node_e,
      _tncstd     type t_tncstd_e,
      _tnct       type t_tnct_e,
      _tncts      type t_tncts_e,
      _tncsf      type t_tncsf_e,
      _seq_tncstd type i,
      _seq_tnct   type i,
      _seq_tncts  type i,
      _seq_tncsf  type i.

    clear _node.
    _node-node_key = root_.
    clear _node-relatkey.
    clear _node-relatship.
    _node-isfolder = 'X'.
    _node-n_image = '@KR@'.
    _node-exp_image = '@KR@'.
    _node-text = 'IS-H Communication - Message Customizing'.
    append _node to node_[].
    loop at tncstd_[] into _tncstd.
      clear _node.
      m_extend_nodekey> _tncstd-nodekey _seq_tncstd.
      _node-node_key  = _tncstd-nodekey.
      _node-relatkey  = root_.
      _node-relatship = cl_gui_simple_tree=>relat_last_child.
      _node-hidden    = ' '.
      _node-disabled  = ' '.
      _node-isfolder  = 'X'.
      if not _tncstd-tnct[] is initial.
        _node-expander  = 'X'.
      endif.
      concatenate
        '['
        _tncstd-tncst-stver
        ']'
        into _node-text.
      concatenate
        _node-text
        _tncstd-tncst-stand
        '-'
        _tncstd-tncsu-stbem
        into _node-text separated by space.
      condense _node-text.
      append _node to node_[].
      " enrich with message types
      loop at _tncstd-tnct[] into _tnct.
        clear _node.
        m_extend_nodekey> _tnct-nodekey _seq_tnct.
        _node-node_key  = _tnct-nodekey.
        _node-relatkey  = _tncstd-nodekey.
        _node-relatship = cl_gui_simple_tree=>relat_last_child.
        _node-isfolder  = 'X'.
        if not _tnct-tncts[] is initial.
          _node-expander  = 'X'.
        endif.
        case _tnct-tnct0-ntownercde+0(1).
          when 'Z'.
            _node-n_image   = '@E2@'.
            _node-exp_image = '@E1@'.
          when others.
            _node-n_image   = '@DZ@'.
            _node-exp_image = '@E0@'.
        endcase.
        concatenate
          ' ('
          _tnct-tnct0-ntownercde
          ')'
          into _node-text.
        concatenate
          _node-text
          _tnct-tnct0-ntnr
          '-'
          _tnct-tnct1-ntbem
          into _node-text separated by space.
        condense _node-text.
        append _node to node_[].
        " enrich with segments
        loop at _tnct-tncts[] into _tncts.
          clear _node.
          m_extend_nodekey> _tncts-nodekey _seq_tncts.
          _node-node_key  = _tncts-nodekey.
          _node-relatkey  = _tnct-nodekey.
          _node-relatship = cl_gui_simple_tree=>relat_last_child.
          _node-isfolder  = 'X'.
          _node-expander  = 'X'.
          concatenate
            ' ('
            _tncts-tncs-tncs0-sgownercde
            ')'
            into _node-text.
          concatenate
            _node-text
            _tncts-tncs-tncs0-sgnr
            '-'
            _tncts-tncs-tncs1-sgbem
            into _node-text separated by space.
          condense _node-text.
          append _node to node_[].
          " enrich with fields
          loop at _tncts-tncs-tncsf[] into _tncsf.
            clear _node.
            m_extend_nodekey> _tncsf-nodekey _seq_tncsf.
            _node-node_key  = _tncsf-nodekey.
            _node-relatkey  = _tncts-nodekey.
            _node-relatship = cl_gui_simple_tree=>relat_last_child.
            case _tncsf-tncf-tncf0-fdnam+0(1).
              when 'Z'.    _node-n_image = '@6C@'.
              when others. _node-n_image = '@6A@'.
            endcase.
            concatenate
              _tncsf-tncf-tncf0-fdnam
              '-'
              _tncsf-tncf-tncf1-fdbem
              into _node-text separated by space.
            condense _node-text.
            append _node to node_[].
          endloop.
        endloop.
      endloop.
    endloop.

  endform.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> HR All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.