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 to set the top node after expand all node? with CL_SALV_TREE

0 Kudos
940

Hi experts,

I have encountered the problem with CL_SALV_TREE class..

After execute program the tree expended node is too long. Thus I want to move first top node. ( I'm not sure the name of TOP NODE is correct or not.)

Experts, can you tell me which method I need to use?

FYI, I will attach the screenshot.

For example, I want to go 'SALV_OM_OBJECTS' node I marked when I start program.

4 REPLIES 4

Sandra_Rossi
Active Contributor
262

If I understand correctly, you want to make the root node visible. Try with the method SALV_TREE->GET_SELECTIONS( )->SET_SELECTED_NODES( ... ) or SALV_TREE->GET_NODES( )->SET_TOP_NODE( ... ) which both do an "ensure visible" (equivalent method ENSURE_VISIBLE of class CL_GUI_COLUMN_TREE).

0 Kudos
262

Thank you Sandra,

I tried to use SALV_TREE->GET_NODES( )->SET_TOP_NODE( ... ) this method..

But Im not familiar with OOP abap programming thus I dont know what is the parameter of the set_top_node( ).

Need to get the top node first?

0 Kudos
262

You should know the top node because you have built the tree.

262

Thank you Sandra, I solved it like this.

DATA: lt_value TYPE salv_t_nodes,
ls_value TYPE salv_s_nodes,
lt_node TYPE salv_t_nodes,
ls_node TYPE salv_s_nodes,
lr_sel TYPE REF TO cl_salv_selections_tree.

lr_nodes = go_tree->get_nodes( ).
lr_sel = go_tree->get_selections( ).
lt_value = lr_nodes->get_all_nodes( ).
READ TABLE lt_value INTO ls_value INDEX 1.
ls_node = ls_value.
APPEND ls_node TO lt_node.

lr_sel->set_selected_nodes( lt_node ).