‎2014 Jul 11 1:18 PM
Hello,
could anyone help me with matching the node shown in the ALV tree with the object reference that contained the data.
In my program I create a hierarchie of objects of different local classes. Then I show this hierarchie using cl_gui_alv_tree on the UI. When someone clicks on one of the nodes I want to show more attributes of the object that is represented by the node. My problem is that I do have a node_key but no way to find out which object the node represents. Is there any way to match the two?
In a different programming language they solved the problem this way: Every node has an attribute called "data" where I can put in whatever I want, for example a reference to an object. Is there any such thing in ABAP or is there any other best practise on how to match the data source withe the node showing the data?
Thank you in advance.
Best regards,
Fenja
‎2014 Jul 11 4:27 PM
Hi Fenja,
as the click-events only raise the node_key (at least I couldn't detect another information), I assume the only way is maintaining an internal helper table by yourself which you build up in parallel when creating the tree and its nodes.
The (hashed) table might contain 2 columns:
1. node_key (as table key)
2. reference to an object
When a click-event is raised, you look up the corresponding object reference in your table.
Regards,
Ulrich
‎2014 Jul 30 4:55 PM
What worked for me is during the build of node, I am concatenating the unique values of the itab into the node_key. This way, I can point back to the actual record by splitting the value and retrieving the correct itab entry.