Revisa este código de muestra
create object g_tree
exporting
parent = g_custom_container
node_selection_mode = cl_gui_simple_tree=>node_sel_mode_single
exceptions
lifetime_error = 1
cntl_system_error = 2
create_error = 3
failed = 4
illegal_node_selection_mode = 5.
if sy-subrc <> 0.
message a000.
endif.
* define the events which will be passed to the backend
call method g_tree->set_registered_events
...
set handler g_application->handle_node_double_click for g_tree.
* Ordenar Nodos
sort g_prog_table by komp_name.
node-node_key = 'Root'.
clear node-relatkey.
clear node-relatship.
...
append node to g_node_table.
loop at g_prog_table into g_wa_prog_table.
* Insertar nodos
clear node.
node-node_key = g_wa_prog_table-key.
node-relatkey = 'Root'.
node-relatship = cl_gui_simple_tree=>relat_last_child.
node-n_image = '@GV@'.
node-expander = ' '.
node-text = g_wa_prog_table-komp_name.
append node to node_table.
endloop.
a®