2008 Dec 18 3:03 PM
Hi,
after a lot of unsatisfying searching I´ll take the chance to open a new thread. I have already implemented a tree by using the CL_GUI_SIMPLE_TREE class. The main nodes of the tree represent material-numbers.
Every material-number has some sub-nodes. My concern is to sort the main nodes ascending. But how can I realize that.
- Material1
|-Subkategorie1
|-Subkategorie2
- Material2
...
I hope i described my problem understandable enought. If anyone has an idea please let me know.
Thanks a lot
2008 Dec 18 3:07 PM
Hi,
Please check the program BCALV_DND_02 and also please do check this link
I don't know whether we can post this links in SCN if it cannot be posted then please delete it.
http://www.sapfans.com/forums/viewtopic.php?f=13&t=103417&start=60
This might help you.
2008 Dec 18 3:16 PM
Check this sample code
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
....
....
* assign event handlers in the application class to each desired event
set handler g_application->handle_node_double_click for g_tree.
* Sort Nodes
sort g_prog_table by komp_name.
node-node_key = 'Root'.
clear node-relatkey. " Special case: A root node has no parent
clear node-relatship. " node.
node-hidden = ' '. " The node is visible,
node-disabled = ' '. " selectable,
node-isfolder = 'X'. " a folder.
clear node-n_image. " Folder-/ Leaf-Symbol in state "closed":
" use default.
clear node-exp_image. " Folder-/ Leaf-Symbol in state "open":
" use default
clear node-expander. " see below.
node-text = text-001.
append node to g_node_table.
loop at g_prog_table into g_wa_prog_table.
* Insert nodes
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®