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_SALV_TREE

Former Member
0 Kudos

Hello All,

   In the class CL_SALV_TREE we can get the node information from method GET_NODES and selections from the method GET_SELECTIONS.

But this class do not have any method that will retrieve expanded nodes.

Event IF_SALV_EVENTS_TREE~EXPAND_EMPTY_FOLDER will only trigger on node which have empty nodes.

I have seen in the package of the class CL_SALV_TREE , there is another class CL_SALV_GUI_TREE, which has the method GET_EXPANDED_NODES.

The class CL_SALV_TREE internally forms a tree using class CL_SALV_GUI_TREE, so we can handle the events triggered in CL_SALV_GUI_TREE in our local implementations.

Is there any way we can get the expanded node details using class CL_SALV_TREE.

We can also use the class CL_GUI_COLUMN_TREE which have majority of functions, but I am using the class CL_SALV_TREE.

With regards,

Sandeep Akella

1 ACCEPTED SOLUTION

former_member184158
Active Contributor
0 Kudos

Hi,

you can use CL_GUI_COLUMN_TREE  better or CL_GUI_ALV_TREE, the last one has many methods, may you need them later.

and there are many actions, Drag, Drop, double click, context menu.

Regards

Ibr

5 REPLIES 5

former_member210008
Active Participant
0 Kudos

Is this what you need: cl_salv_tree->get_selections( )->get_selected_nodes( ) ?

This method also returns the selected nodes.

Former Member
0 Kudos

Hello Evgeniy,

       Thank you for your reply. I am looking for nodes which are expanded, not for selected.

With regards,

Sandeep Akella

0 Kudos

Oh.. I think there is only one way: recursively get nodes and check that they have visible child nodes.


Something like this (it's a conept code add some checks to prevent dumps 😞

form f1 using p_node type ref to cl_salv_node.

     data(nodes) = p_node->get_children( ).

     loop at nodes assigning field-symbol(<fs>).

          try.

               data(child) = <fs>-node->get_first_child( ).

               if child->is_visible.

                    "your <fs>-node is expanded

                    "do what you need

                    "and then lets check child's children

                    perform f1 using child.

               else.

                    "your <fs>-node is NOT expanded

               endif.

          catch cx_salv_msg.

               "there will be exception if node has no children

               "so your <fs>-node can't be expanded.

          endtry.

     endloop.

endform.


And call it:

perform f1 using cl_salv_tree_object->get_nodes( )->get_root_node( ).

0 Kudos

Hello Evgeniy,

Those methods are not working. I am using the class CL_GUI_ALV_TREE, which has more flexibility.



With regards,

Sandeep Akella


former_member184158
Active Contributor
0 Kudos

Hi,

you can use CL_GUI_COLUMN_TREE  better or CL_GUI_ALV_TREE, the last one has many methods, may you need them later.

and there are many actions, Drag, Drop, double click, context menu.

Regards

Ibr