03-24-2007 10:46 AM
In the existing programm cl_gui_alv_tree is used. Nodes are displayed in the order of their keys. Now the goal is to change this order, i meen to sort nodes by their items texts. Is anybody know the solution, how to do this without changing the procedure of making tree hierarchy?
03-26-2007 6:13 PM
sort the internal table with the item text instead of the the item key and check it before passing the data into the node in the hierarchy creation.
03-26-2007 6:31 PM
Alek,
You must set the order in the SORT table.
call method l_tree_simple->set_table_for_first_display
exporting
it_list_commentary = lt_list_commentary
i_logo = l_logo
i_background_id = 'ALV_BACKGROUND'
i_save = g_save
i_default = g_default
is_variant = ls_variant
is_layout = ls_layout
it_toolbar_excluding = l_toolbar_excluding
it_grouplevel_layout = lt_grouplevel_layout
changing
it_sort = gt_sort " <==== HERE !!!!
it_outtab = gt_outtab
it_fieldcatalog = gt_fieldcatalog.
Set your sort order in a FORM like this:
form build_sort_table.
data ls_sort_wa type lvc_s_sort.
create sort-table
ls_sort_wa-spos = 1.
ls_sort_wa-fieldname = 'CARRID'.
ls_sort_wa-up = 'X'.
ls_sort_wa-subtot = 'X'.
append ls_sort_wa to gt_sort.
ls_sort_wa-spos = 2.
ls_sort_wa-fieldname = 'CONNID'.
ls_sort_wa-up = 'X'.
ls_sort_wa-subtot = 'X'.
append ls_sort_wa to gt_sort.
ls_sort_wa-spos = 3.
ls_sort_wa-fieldname = 'FLDATE'.
ls_sort_wa-up = 'X'.
append ls_sort_wa to gt_sort.
endform. " BUILD_SORT_TABLE