Skip to Content

How to set the top node after expand all node? with CL_SALV_TREE

Nov 15, 2017 at 10:21 AM


avatar image

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.

image1.png (22.0 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Sandra Rossi Nov 15, 2017 at 02:11 PM

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

Show 3 Share
10 |10000 characters needed characters left characters exceeded

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?


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


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