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: 

How do I expand all nodes on a tree structure using CL_GUI_LIST_TREE

Former Member
0 Kudos

Hi,

I've created a tree structure using the class CL_GUI_LIST_TREE but my customer wants all the nodes expanded when they open this screen instead of having to expand them themselves. How can I do this?

Thanks,

Gill

1 ACCEPTED SOLUTION

former_member194669
Active Contributor
0 Kudos

I think you need to call


CALL METHOD g_alv_tree->expand_nodes
EXPORTING
it_node_key = it_node_key

after the call method set_table_for_first_display

4 REPLIES 4

former_member194669
Active Contributor
0 Kudos

I think you need to call


CALL METHOD g_alv_tree->expand_nodes
EXPORTING
it_node_key = it_node_key

after the call method set_table_for_first_display

0 Kudos

Do I need to do this for all nodes? Is there a method I can call which expands all nodes?

0 Kudos

Please check program

MSABAPDEMOS_TREEF01 and form create_and_init_tree.

line no 125

Former Member
0 Kudos

I used the following code:

LOOP AT node_table INTO node_wa.

IF node_wa-node_key(1) NE 'C'.

CALL METHOD g_tree->expand_node

EXPORTING

node_key = node_wa-node_key.

ENDIF.

ENDLOOP.

C marking the node as a child and P for parent so this opens all Parent nodes.