Skip to Content
avatar image
Former Member

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

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)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

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