
lo_nodes = go_tree->get_nodes( ).
lv_text = CONV #( p_file ).
TRY.
*--- Add the root node
lo_node = lo_nodes->add_node(
related_node = ' '
relationship = cl_salv_nodes=>if_salv_c_node_relation~parent
text = lv_text
visible = abap_true
expander = abap_true
folder = abap_true ).
CATCH cx_salv_msg. "
MESSAGE s001(icl) WITH lv_text.
ENDTRY.
*--- Set PF status Adding all the functions required
go_tree->set_screen_status(
EXPORTING
report = sy-repid " ABAP Program: Current Master Program
pfstatus = 'PF_STATUS' " Screens, Current GUI Status
set_functions = go_tree->c_functions_all " ALV: Data Element for Constants
).
TRY.
lo_nodes = go_tree->get_nodes( ).
lo_node = lo_nodes->get_node( node_key = node_key ).
CATCH cx_salv_msg.
FREE : lo_nodes,lo_node.
ENDTRY.
ls_datarow = lo_node->get_data_row( ).
ASSIGN ls_datarow->* TO <lfs_rowdata>.
*--- If the root node is clicked then the address comes from the parameters
IF <lfs_rowdata>-address IS NOT INITIAL.
lv_file = <lfs_rowdata>-address.
ELSE.
lv_file = p_file.
ENDIF.
me->md_directory_open( iv_file = lv_file ).
me->md_create_node( iv_key = node_key ).
*--- Create the sub nodes after expansion
LOOP AT lt_main INTO ls_main.
*--- Differentiate the files from the folders
IF ls_main-filtyp = TEXT-003.
lv_text = ls_main-name.
TRY.
lo_node = lo_nodes->add_node(
related_node = lv_key
relationship = cl_gui_column_tree=>relat_last_child
data_row = ls_main
text = lv_text
visible = abap_true
expander = 'X'
folder = 'X' ).
CATCH cx_salv_msg. "
FREE lo_node.
ENDTRY.
ELSE.
lv_text = ls_main-name.
TRY.
lo_node = lo_nodes->add_node(
related_node = lv_key
relationship = cl_gui_column_tree=>relat_last_child
data_row = ls_main
text = lv_text
visible = abap_true
expander = ' '
folder = ' '
).
CATCH cx_salv_msg. "
FREE lo_node.
ENDTRY.
ENDIF.
ENDLOOP.
TRY.
lo_sels = go_tree->get_selections( ).
lo_item = lo_sels->get_selected_item( ).
IF lo_item IS NOT INITIAL.
lo_node_parent = lo_item->get_node( ).
lo_key = lo_node_parent->get_key( ).
lt_childr = lo_node_parent->get_children( ).
ELSE.
MESSAGE i303(42).
ENDIF.
*--- Getting the childrens of the selected node and then deleting them and creating them again with the sorted data
LOOP AT lt_childr ASSIGNING <ls_childr>.
ls_datarow = <ls_childr>-node->get_data_row( ).
<ls_childr>-node->delete( ).
ASSIGN ls_datarow->* TO <lfs_rowdata>.
APPEND <lfs_rowdata> TO lt_main.
ENDLOOP.
CATCH cx_salv_msg.
FREE <ls_childr>.
ENDTRY.
me->md_create_node( iv_key = lo_key ).
TRY.
lo_sels = go_tree->get_selections( ).
lo_item = lo_sels->get_selected_item( ).
IF lo_item IS NOT INITIAL.
lo_node_parent = lo_item->get_node( ).
lt_childr = lo_node_parent->get_children( ).
ELSE.
MESSAGE i303(42).
ENDIF.
LOOP AT lt_childr ASSIGNING <ls_childr>.
ls_datarow = <ls_childr>-node->get_data_row( ).
ASSIGN ls_datarow->* TO <lfs_rowdata>.
IF <lfs_rowdata>-name NP iv_filters.
<ls_childr>-node->delete( ).
ENDIF.
ENDLOOP.
CATCH cx_salv_msg.
FREE lo_nodes.
ENDTRY.
TRY.
lo_nodes = go_tree->get_nodes( ).
lo_nodes->delete_all( ).
CATCH cx_salv_error.
FREE lo_nodes.
ENDTRY.
me->md_display_initial( ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
7 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 | |
4 |