Skip to Content

Expanded nodes on CL_SALV_TREE

Hi there,

I have built a tree using CL_SALV_TREE. The requirement is to

1. Load data dynamically into the tree when requested

2. Expand nodes and set focus exactly as they were before loading the new data.

The first is no problem using the EXPAND_EMPTY_FOLDER event. The second however is very frustrating because CL_SALV_TREE seems not to have any method for getting expanded nodes (contrary to CL_GUI_ALV_TREE which has the method GET_EXPANDED_NODES). I had to switch from CL_GUI_ALV_TREE to CL_SALV_TREE because I'm refactoring and moved the tree from a report environment with screens and containers to an OO environment without any of these. In that new environment I couldn't manage to get the tree displayed with CL_GUI_ALV_TREE (no container anymore) while CL_SALV_TREE runs out of the box (another thing in that regard: I find it a bit strange that you have to use screen status for adding additional toolbar buttons with CL_SALV_TREE while with CL_GUI_ALV_TREE it's possible to manipulate the toolbar object (CL_GUI_TOOLBAR) directly. Maybe I overlooked something?).

The aim of the refactoring is (among others) to have as few code as possible outside of OO environment.

I figured that there are several attributes/methods of class CL_SALV_NODE which let me expand and collapse the nodes and set nodes to be expandable or not but I couldn't find any that tells me which nodes _are_ already expanded. The (private) attribute NODE_SETTINGS doesn't seem to have that information, either.

I did an extensive search for that problem and the general solution seems to be to switch to CL_GUI_ALV_TREE (if there is a solution offered at all...), however unless someone can tell me how to get the CL_GUI_ALV_TREE get displayed without any container in OO environment, returning to that class is no option. Plus: SAP seems to recommend using the SALV-classes...

Any help is appreciated!

Thanks and Regards

Add comment
10|10000 characters needed characters exceeded

  • Problem solved.

    I made a workaround so I don't need to rebuild the tree but simply insert the new lines at appropiate positions (a bit tricky, too, because you have to identify the nodes by their data instead of their node keys).

    Thus the expanded nodes stay expanded.

    Question closed.

  • Get RSS Feed

0 Answers