I program some trees in java webdynpro, but in abap wd it’s slightly different…easier on one side, but with no documentation could be quite complex.
Suppose you wish to build a dynamic tree, so you declare a tree control with a recursive node under it:
The tree node type shoud be binded to a context node which contain a recursive node under it; in this case the treeservices is the upper node of the tree in the context.
the event ‘onLoadChildren’ is raised when you expand a tree node; here the critical role is assumed by the parameter PATH which tell us positioning.
Here, the method ZGETLEAF of the component controller will retrieve the data for the expanded node:
Of course, I use an attribute in the tree context to know if I already loaded the data for that branch.
Also the first level of the tree is loaded in the WDDOINIT method of the view(via calling of a component controller method).