ABAP - Create Hierarchy Tree List using rs_tree_construct, rs_tree_list_display and snodetext
RS_TREE_LIST_DISPLAY is a function module which is used to display hierarchy.
rs_tree_list_display function module enables ABAP developers to display hierarchy structures.
It is also possible for ABAP programmers to manipulate hierarchies interactively.
Using rs_tree_list_display it is possible to use different colors for link nodes, node texts and to use icons for link nodes.
Here is the sample hierarchy tree screen display of the ABAP report example.
You can find the ABAP code of the example ABAP report used to create hierarchy tree list using rs_tree_list_display.
Here is an ABAP sample report with ABAP source code for ABAP developers displaying the Chapter hierarchy tree of ABAP Objects book using rs_tree_construct and rs_tree_list_display.
Note that in the above ABAP program, the first ABAP code block builds the gt_contents which is a table of snodetext where the node information is stored.
The second part of the example ABAP report zCreate_treelist_sample, populates the gt_nodetab within a ABAP LOOP structure.
In the ABAP LOOP, the gs_nodetab workarea fields are read from internal table.
Then we append each workarea structure to the gt_nodetab internal table which is used to construct the ABAP hierarchy tree list using RS_TREE_CONSTRUCT function call.
After the hierarchy tree is constructed, using the RS_TREE_LIST_DISPLAY ABAP function ABAP developers can display the sample hierarchy on the SAP screen.