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: 

CL_SAV_TREE How to expand node

former_member210118
Participant
0 Kudos
587

Good morning,

I'm using CL_SALV_TREE to create a tree for displaying data.

What I'm trying to do is if I double click the folder node (parent node), then the program must expand the children of that parent node. I already have the programing for double click event but now I need a way of expanding the parent node.

Anyone can help me achieve this ?

Thank you all,

Ricardo Monteiro

1 ACCEPTED SOLUTION

former_member210118
Participant
211

Hi sandra.rossi ,

Thank you for your reply.

Is it needed some kind of refresh of the tree?

I have the following code and the tree is not expanding:

lo_nodes = lo_tree->get_nodes( ).
lo_node = lo_nodes->get_node( v_node_num ).
lo_node->expand(  EXPORTING complete_subtree = abap_true ).
4 REPLIES 4

Sandra_Rossi
Active Contributor
211

Methods GET_NODES then GET_NODE then EXPAND...

former_member210118
Participant
212

Hi sandra.rossi ,

Thank you for your reply.

Is it needed some kind of refresh of the tree?

I have the following code and the tree is not expanding:

lo_nodes = lo_tree->get_nodes( ).
lo_node = lo_nodes->get_node( v_node_num ).
lo_node->expand(  EXPORTING complete_subtree = abap_true ).

0 Kudos
211

Right now, I don't see any clear solution, it seems there's a bug. If you do another call to adapt the frontend, it will work (it's not related to expand/collapse but it sends a signal to push the changes to the frontend...). For instance:

lo_tree->get_columns->set_optimize( ).

211

Here are other dummy "frontend updates" which work (choose the one you prefer, there should be no difference):

lo_tree->get_nodes( )->get_top_node( )->set_visible( lo_tree->get_nodes( )->get_top_node( )->is_visible( ) ).

Or

lo_tree->get_nodes( )->set_top_node( lo_tree->get_nodes( )->get_top_node( )->get_key( ) ).

Or, if you don't display the tree in a popup, calling CLOSE_SCREEN has no effect except that it triggers frontend updates:

lo_tree->close_screen( ).