Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ALV tree

Former Member
0 Kudos
79

Hi All,

I need a help on ALV tree display. I'm using the function RS_TREE_LIST_DISPLAY and RS_TREE_CONSTRUCT fro that. Im able to display the parent node but i'm not able to further create a drop down ie im not able to further drop down the plus sign.

Please help me out what would be the error im doing.

1 REPLY 1

Former Member
0 Kudos
43

Hi,

Try this Program and compare it with yours.

Type-pools : fibs,stree,slis.

data : t_node type snodetext.

data : node_tab like t_node occurs 0 with header line.

DATA: G_REPID LIKE SY-REPID.

clear : node_tab, node_tab[].

*start-of-selection.

node_tab-type = 'T'.

node_tab-name = 'R1'.

node_tab-tlevel = '01'.

node_tab-nlength = '10'.

node_tab-color = '4'.

node_tab-text = 'Hello'.

node_tab-tlength ='10'.

node_tab-tcolor = 3.

append node_tab.

clear node_tab.

node_tab-type = 'P'.

node_tab-name = 'M1'.

node_tab-tlevel = '02'.

node_tab-nlength = '20'.

node_tab-color = '1'.

node_tab-text = 'Hello'.

node_tab-tlength ='20'.

node_tab-tcolor = 4.

append node_tab.

clear node_tab.

node_tab-type = 'P'.

node_tab-name = 'O1'.

node_tab-tlevel = '03'.

node_tab-nlength = '7'.

node_tab-color = '4'.

node_tab-text = 'Hello'.

node_tab-tlength ='7'.

node_tab-tcolor = 4.

append node_tab.

clear node_tab.

*

node_tab-type = 'P'.

node_tab-name = 'G1'.

node_tab-tlevel = '04'.

node_tab-nlength = '6'.

node_tab-color = '4'.

node_tab-text = 'Hello'.

node_tab-tlength ='5'.

node_tab-tcolor = 3.

append node_tab.

clear node_tab.

*

node_tab-type = 'P'.

node_tab-name = 'C1'.

node_tab-tlevel = '02'.

node_tab-nlength = '12'.

node_tab-color = '1'.

node_tab-text = 'Hello'.

node_tab-tlength ='12'.

node_tab-tcolor = 3.

append node_tab.

clear node_tab.

node_tab-type = 'P'.

node_tab-name = 'C2'.

node_tab-tlevel = '03-'.

node_tab-nlength = '5'.

node_tab-color = '1'.

node_tab-text = 'Hello'.

node_tab-tlength ='5'.

node_tab-tcolor = 3.

append node_tab.

clear node_tab.

*

node_tab-type = 'P'.

node_tab-name = 'G1'.

node_tab-tlevel = '04-'.

node_tab-nlength = '6'.

node_tab-color = '1'.

node_tab-text = 'Hello'.

node_tab-tlength ='5'.

node_tab-tcolor = 3.

append node_tab.

clear node_tab.

CALL FUNCTION 'RS_TREE_CONSTRUCT'

  • EXPORTING

  • INSERT_ID = '000000'

  • RELATIONSHIP = ' '

  • LOG =

TABLES

NODETAB = node_tab

  • 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.

DATA: type_mapping TYPE stree_ctl_type_mapping_tab.

DATA: wa_type TYPE stree_ctl_type_mapping.

CLEAR: type_mapping[].

wa_type-type = 'A'.

wa_type-icon = '@BL@'.

APPEND wa_type TO type_mapping.

*CALL FUNCTION 'RS_TREE_CONTROL_PREPARE'

  • EXPORTING

    • CONTROL_PATTERN = STREE_CTL_GENERIC

  • CONTROL_PATTERN = 'PH'

*

    • HIERARCHY_HEADER =

    • INITIAL_HEADER_WIDTH =

    • LIST_ITEM_HEADER =

  • MULTIPLE_SELECTION = 'X'

    • ITEM_SELECTION = STREE_FALSE

    • SUPPRESS_NODE_ICON = STREE_FALSE

    • SUPPRESS_FOLDER_ICON = STREE_FALSE

    • CALLBACK_PROGRAM =

    • CALLBACK_ITEM_DISPLAY =

    • COLOR_MAPPING =

  • TYPE_MAPPING = type_mapping

    • IMPORTING

    • SUBSCREEN_PROGRAM =

    • SUBSCREEN_DYNNR =

    • EXCEPTIONS

    • NOT_AVAILABLE = 1

    • OTHERS = 2

  • .

*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_SET_CURRENT_LAYOUT'

    • EXPORTING

    • CURSOR_COLUMN = 3

    • CURSOR_LINE = 2

    • FIRST_NODE = 1

    • FIRST_NODE_TYPE = ' '

    • LIST_COLUMN = 1

    • LIST_LINE = 1

    • LAYOUT_MODE = STREE_LAYOUT_NORMAL

    • IMPORTING

    • INCONSISTENT_LAYOUT =

    • TABLES

    • LAYOUT =

  • .

CALL FUNCTION 'RS_TREE_LIST_DISPLAY'

EXPORTING

  • CALLBACK_PROGRAM =

  • CALLBACK_USER_COMMAND =

  • CALLBACK_TEXT_DISPLAY =

  • CALLBACK_MOREINFO_DISPLAY =

  • CALLBACK_COLOR_DISPLAY =

CALLBACK_TOP_OF_PAGE = 'GT_LIST_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

USE_CONTROL = 'L'.

  • IMPORTING

  • F15 =