Creating trees
In this recipe, we will see how we can display a tree in our Web Dynpro application. We will create a tree that will display the employee department-wise data, that is, nodes showing department names, each of which when opened will display a list of employees within the department along with the employee names.
For the sake of this recipe, we assume that we have an internal table DATA_TAB
comprising of three fields, department
, pernr
, and sname
containing the department name, employee number, and the employee names respectively sorted according to the department name.

How to do it...
We will now follow the steps as shown:
We first define a context node
TREE_NODE
. TheTREE_NODE
context node has a cardinality of0..N
and theSingleton
property should beOff
. AnIS_OPENED
attribute will be based on the typeWDY_BOOLEAN
.Within the
TREE_NODE
context node there is another node,TREE_NODE_ITEM
, which is also a non-singleton node having cardinality0..N
. An attributeITEM_TEXT
is created...