Summary :
This Report in the tree format contains information HR
*&---------------------------------------------------------------------*
*& Report Z_ALV_TREE_ *
*& *
*&---------------------------------------------------------------------*
*& *
*& AUTHOR TECH.SAP29@GMAIL.COM *
*&---------------------------------------------------------------------*
REPORT Z_ALV_TREE_PROGRAM2 .
TYPE-POOLS: SLIS,
STREE,
FIBS.
DATA : IT_NODE TYPE TABLE OF SNODETEXT,
WA_NODE TYPE SNODETEXT.
DATA : IT_002 TYPE TABLE OF PA0022 ,
IT_517 TYPE TABLE OF T517X,
IT_517T TYPE TABLE OF T517T,
IT_519T TYPE TABLE OF T519T,
WA_002 TYPE PA0022,
WA_517 TYPE T517X,
WA_517T TYPE T517T,
WA_519T TYPE T519T.
*initialization event
INITIALIZATION.
*Start of selection event
START-OF-SELECTION.
*Select the data for tree
PERFORM fetch_data.
*Build the hierarchy for tree
PERFORM build_hierarchy.
*Build Tree for display
PERFORM build_tree.
*&---------------------------------------------------------------------*
*& Form fetch_data
*&---------------------------------------------------------------------*
form fetch_data .
SELECT * FROM pa0022 INTO CORRESPONDING FIELDS OF TABLE it_002
UP TO 50 ROWS.
*select data from T517x
SELECT * FROM t517x INTO CORRESPONDING FIELDS OF TABLE it_517
WHERE langu = 'E'.
*select data from T517T
SELECT * FROM t517t INTO CORRESPONDING FIELDS OF TABLE it_517t
WHERE sprsl = 'E'.
*select data from T519t
SELECT * FROM t519t INTO CORRESPONDING FIELDS OF TABLE it_519t
WHERE sprsl = 'E'.
endform. " fetch_data
*&---------------------------------------------------------------------*
*& Form build_hierarchy
*&---------------------------------------------------------------------*
form build_hierarchy .
* Building the nodes and hierarchy for tree
CLEAR : it_node[], wa_node.
wa_node-type = 'T'.
wa_node-name = 'Education'.
wa_node-tlevel = '01'.
wa_node-nlength = '15'.
wa_node-color = '4'.
wa_node-text = 'Infotype 0022'.
wa_node-tlength ='20'.
wa_node-tcolor = 3.
APPEND wa_node TO it_node.
CLEAR wa_node.
LOOP AT it_002 INTO wa_002.
wa_node-type = 'P'.
wa_node-name = 'PERNR'.
wa_node-tlevel = '02'.
wa_node-nlength = '8'.
wa_node-color = '1'.
wa_node-text = wa_002-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_517t INTO wa_517t WITH KEY slart = wa_002-slart.
wa_node-type = 'P'.
wa_node-name = wa_002-slart.
wa_node-tlevel = '03'.
wa_node-nlength = '8'.
wa_node-color = '1'.
wa_node-text = wa_517t-stext.
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_519t INTO wa_519t WITH KEY slabs = WA_002-slabs.
wa_node-type = 'P'.
wa_node-name = WA_002-slabs.
wa_node-tlevel = '04'.
wa_node-nlength = '8'.
wa_node-color = '2'.
wa_node-text = wa_519t-stext.
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_517 INTO wa_517 WITH KEY faart = WA_002-sltp1.
wa_node-type = 'P'.
wa_node-name = WA_002-sltp1.
wa_node-tlevel = '05'.
wa_node-nlength = '8'.
wa_node-color = '1'.
wa_node-text = wa_517-ftext.
wa_node-tlength ='40'.
wa_node-tcolor = 4.
APPEND wa_node TO it_node.
CLEAR wa_node.
ENDLOOP.
endform. " build_hierarchy
*&---------------------------------------------------------------------*
*& Form build_tree
*&---------------------------------------------------------------------*
form build_tree .
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 =
.
endform. " build_tree
No comments:
Post a Comment