Saturday, December 24, 2011

ALV Tree display



*&---------------------------------------------------------------------*
*& Report  YSAP_ALV_TREE_LIST
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  YSAP_ALV_TREE_LIST.


type-pools: fibs, stree." slis.

tables: pa0001, pa0002, pa0006, pa0008, pa0009.

select-options: pernr for pa0001-pernr.

data : t_node type snodetext.
data : it_node like table of t_node initial size 0,
       wa_node like t_node.

data : it_0001 type standard table of pa0001 initial size 0,
       wa_0001 type pa0001.

data : it_0002 type standard table of pa0002 initial size 0,
       wa_0002 type pa0002.

data : it_0006 type standard table of pa0006 initial size 0,
       wa_0006 type pa0006.

data : it_0008 type standard table of pa0008 initial size 0,
       wa_0008 type pa0008.

data : it_0009 type standard table of pa0009 initial size 0,
       wa_0009 type pa0009.

start-of-selection.

select * from pa0001 into table it_0001 where pernr in pernr.
select * from pa0002 into table it_0002 where pernr in pernr.
select * from pa0006 into table it_0006 where pernr in pernr.
select * from pa0008 into table it_0008 where pernr in pernr.
select * from pa0009 into table it_0009 where pernr in pernr.

clear : it_node[], wa_node.

  wa_node-type = 'T'.
  wa_node-name = 'Details'.
  wa_node-tlevel = '01'.
  wa_node-nlength = '15'.
  wa_node-color = '6'.
  wa_node-text = 'Personnel details'.
  wa_node-tlength ='20'.
  wa_node-tcolor = 3.
  append wa_node to it_node.
  clear wa_node.

loop at it_0001 into wa_0001.

    wa_node-type = 'P'.
    wa_node-name = 'PERNR'.
    wa_node-tlevel = '02'.
    wa_node-nlength = '8'.
    wa_node-color = '1'.
    wa_node-text = wa_0001-pernr.
    wa_node-tlength ='20'.
    wa_node-tcolor = 4.
    append wa_node to it_node.
    clear wa_node.
*Filling the text of T517t

    read table it_0002 into wa_0002 with key pernr = wa_0001-pernr.
    wa_node-type = 'P'.
    wa_node-name = 'VORNA'.
    wa_node-tlevel = '03'.
    wa_node-nlength = '20'.
    wa_node-color = '1'.
    wa_node-text = wa_0002-vorna.
    wa_node-tlength ='40'.
    wa_node-tcolor = 4.
    append wa_node to it_node.
    clear wa_node.
*Filling the text of T519t
    read table it_0006 into wa_0006 with key pernr = wa_0001-pernr.
    wa_node-type = 'P'.
    wa_node-name = 'STRAS'.
    wa_node-tlevel = '04'.
    wa_node-nlength = '40'.
    wa_node-color = '2'.
    wa_node-text = wa_0006-stras.
    wa_node-tlength ='40'.
    wa_node-tcolor = 4.
    append wa_node to it_node.
    clear wa_node.
*Filling the text of T517x
    read table it_0008 into wa_0008 with key pernr = wa_0001-pernr.
    wa_node-type = 'P'.
    wa_node-name = 'PAYSCALE GROUP'.
    wa_node-tlevel = '05'.
    wa_node-nlength = '30'.
    wa_node-color = '1'.
    wa_node-text = wa_0008-TRFGR.
    wa_node-tlength ='40'.
    wa_node-tcolor = 4.
    append wa_node to it_node.
    clear wa_node.
read table it_0009 into wa_0009 with key pernr = wa_0001-pernr.
    wa_node-type = 'P'.
    wa_node-name = 'BANKN'.
    wa_node-tlevel = '06'.
    wa_node-nlength = '8'.
    wa_node-color = '1'.
    wa_node-text = wa_0009-bankn.
    wa_node-tlength ='40'.
    wa_node-tcolor = 4.
    append wa_node to it_node.
    clear wa_node.

    wa_node-type = 'P'.
    wa_node-name = 'BANK STATE'.
    wa_node-tlevel = '06'.
    wa_node-nlength = '8'.
    wa_node-color = '1'.
    wa_node-text = wa_0009-bankl.
    wa_node-tlength ='15'.
    wa_node-tcolor = 4.
    append wa_node to it_node.
    clear wa_node.
    endloop.

    CALL FUNCTION 'RS_TREE_CONSTRUCT'
*     EXPORTING
*       INSERT_ID                                  = '000000'
*       RELATIONSHIP                          = ' '
*       LOG                                             =
      TABLES
        nodetab                                         = it_node
*     EXCEPTIONS
*       TREE_FAILURE                          = 1
*       ID_NOT_FOUND                       = 2
*       WRONG_RELATIONSHIP         = 3
*       OTHERS                                      = 4
              .
    IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
     EXPORTING
       CALLBACK_PROGRAM                           = sy-repid
*       CALLBACK_USER_COMMAND           =
*       CALLBACK_TEXT_DISPLAY                 =
*       CALLBACK_MOREINFO_DISPLAY      =
*       CALLBACK_COLOR_DISPLAY             =
*       CALLBACK_TOP_OF_PAGE                  =
*       CALLBACK_GUI_STATUS                      =
*       CALLBACK_CONTEXT_MENU             =
*       STATUS                                                      = 'IMPLICIT'
       CHECK_DUPLICATE_NAME                    = '1'
       COLOR_OF_NODE                                    = '4'
       COLOR_OF_MARK                                   = '3'
       COLOR_OF_LINK                                     = '1'
       COLOR_OF_MATCH                                 = '5'
*       LOWER_CASE_SENSITIVE                    = ' '
*       MODIFICATION_LOG                             = ' '
       NODE_LENGTH                                         = 30
       TEXT_LENGTH                                           = 75
*       TEXT_LENGTH1                                       = 0
*       TEXT_LENGTH2                                       = 0
*       RETURN_MARKED_SUBTREE               = ' '
*       SCREEN_START_COLUMN                    = 0
*       SCREEN_START_LINE                             = 0
*       SCREEN_END_COLUMN                        = 0
*       SCREEN_END_LINE                                = 0
*       SUPPRESS_NODE_OUTPUT                   = ' '
*       LAYOUT_MODE                                       = ' '
*       USE_CONTROL                                        = STREE_USE_LIST
*     IMPORTING
*       F15                                                             =
   

Give Personnel numbers:












Output:

 

No comments:

Post a Comment