2017 Nov 15 10:21 AM
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.
2017 Nov 15 2: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).
2017 Nov 16 1:32 AM
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?
2017 Nov 16 7:16 AM
You should know the top node because you have built the tree.
2017 Nov 24 2:01 AM
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 ).