SAP Program SAPTREX3 - Example: Simple Tree Control (with Documentation)

Description
The program SAPTREX3 is a demonstration of a simple tree control.
In a simple tree control, each node consists of a folder or leaf symboland a text. The nodes are described by the ABAP Dictionary structureTREEV_NODE. You must include this structure in another structure thatalso has a field named 'TEXT'.

Events
The events that occur during the program are displayed on theright-hand side of the screen. The following events can be triggered:

node_dbl_clk (node double click)
The user double-clicked a node.

node_context_men
The user pressed the right mouse button while positioned on a folder orleaf symbol. The parameter of the event is the node key.

expand_nc (expand no children)
You can configure nodes so that their folder or leaf symbol contains aplus sign even though the node has no children (EXPANDER field inTREEV_NODE). If the user then clicks one of these nodes, the eventEXPAND_NC is triggered. In the example, the node "Child1" has thisattribute. The demonstration program reacts to the event by adding twonew nodes to the control (New1 and New2).