1- CLASS y_alv_tree_control DEFINITION
2- PUBLIC
3- CREATE PUBLIC .
1+ CLASS y_alv_tree_control DEFINITION PUBLIC CREATE PUBLIC .
42
53 PUBLIC SECTION .
64
@@ -18,18 +16,18 @@ CLASS y_alv_tree_control DEFINITION
1816 events TYPE REF TO y_if_alv_events
1917 event_mode TYPE i DEFAULT y_if_alv_events=>mode_double_click
2018 RETURNING
21- VALUE (result ) TYPE REF TO y_if_alv_tree_control
19+ VALUE (result ) TYPE REF TO y_if_alv_tree_control
2220 RAISING
2321 cx_sy_create_data_error
2422 cx_failed.
2523
2624 METHODS constructor
2725 IMPORTING
28- type_name TYPE string
29- sort_table TYPE lvc_t_sort
30- events TYPE REF TO y_if_alv_events
31- alv_tree TYPE REF TO cl_gui_alv_tree_simple
32- alv_header TYPE slis_t_listheader
26+ type_name TYPE string
27+ sort_table TYPE lvc_t_sort
28+ events TYPE REF TO y_if_alv_events
29+ alv_tree TYPE REF TO cl_gui_alv_tree_simple
30+ alv_header TYPE slis_t_listheader
3331 RAISING
3432 cx_sy_create_data_error
3533 cx_failed.
@@ -51,7 +49,7 @@ ENDCLASS.
5149
5250
5351
54- CLASS y_alv_tree_control IMPLEMENTATION .
52+ CLASS Y_ALV_TREE_CONTROL IMPLEMENTATION .
5553
5654
5755 METHOD autosize_all_fields .
@@ -77,13 +75,14 @@ CLASS y_alv_tree_control IMPLEMENTATION.
7775
7876
7977 METHOD create .
80- DATA (docking_container ) = NEW cl_gui_docking_container( repid = sy_repid
81- dynnr = dynpro_nr
82- side = docking_side
83- ratio = ratio ).
78+ DATA (docking_container ) = NEW cl_gui_docking_container( repid = sy_repid
79+ dynnr = dynpro_nr
80+ side = docking_side
81+ ratio = ratio ).
8482
8583 DATA (alv_tree ) = NEW cl_gui_alv_tree_simple( i_parent = docking_container
86- i_item_selection = '' ).
84+ i_item_selection = abap_false
85+ i_no_html_header = abap_true ).
8786
8887 alv_tree->get_toolbar_object( IMPORTING er_toolbar = DATA (alv_toolbar ) ).
8988
@@ -134,9 +133,9 @@ CLASS y_alv_tree_control IMPLEMENTATION.
134133 IF sy -subrc EQ 0 .
135134 alv_tree->get_selected_nodes( CHANGING ct_index_outtab = index_table ).
136135 TRY .
137- result = index_table[ 1 ].
138- CATCH cx_sy_itab_line_not_found.
139- RAISE EXCEPTION TYPE ycx_entry_not_found.
136+ result = index_table[ 1 ].
137+ CATCH cx_sy_itab_line_not_found.
138+ RAISE EXCEPTION TYPE ycx_entry_not_found.
140139 ENDTRY .
141140 ENDIF .
142141 ENDMETHOD .
@@ -154,11 +153,8 @@ CLASS y_alv_tree_control IMPLEMENTATION.
154153 dp_error = 2
155154 failed = 3
156155 error_in_node_key_table = 4
157- others = 5
158- ). "#EC OPTL_EXP
159- IF SY -SUBRC <> 0 .
160- BREAK-POINT .
161- ENDIF .
156+ OTHERS = 5
157+ ).
162158 ENDMETHOD .
163159
164160
@@ -175,7 +171,7 @@ CLASS y_alv_tree_control IMPLEMENTATION.
175171
176172 alv_tree->set_table_for_first_display(
177173 EXPORTING
178- it_list_commentary = alv_header
174+ it_list_commentary = alv_header
179175 it_toolbar_excluding = get_excluded_toolbars( )
180176 CHANGING
181177 it_sort = sort
@@ -226,4 +222,28 @@ CLASS y_alv_tree_control IMPLEMENTATION.
226222 METHOD y_if_alv_tree_control ~to_focus .
227223 cl_gui_control=>set_focus( alv_tree ).
228224 ENDMETHOD .
225+
226+
227+ METHOD y_if_alv_tree_control ~activate_toolbar .
228+ LOOP AT y_if_alv_tree_control~toolbar_control( )->m_table_button ASSIGNING FIELD-SYMBOL (<button> ).
229+ y_if_alv_tree_control~toolbar_control( )->set_button_state( EXPORTING enabled = abap_true
230+ fcode = <button> -function
231+ EXCEPTIONS OTHERS = 4 ).
232+ IF sy -subrc NE 0 .
233+ RAISE EXCEPTION TYPE cx_failed.
234+ ENDIF .
235+ ENDLOOP .
236+ ENDMETHOD .
237+
238+
239+ METHOD y_if_alv_tree_control ~deactivate_toolbar .
240+ LOOP AT y_if_alv_tree_control~toolbar_control( )->m_table_button ASSIGNING FIELD-SYMBOL (<button> ).
241+ y_if_alv_tree_control~toolbar_control( )->set_button_state( EXPORTING enabled = abap_false
242+ fcode = <button> -function
243+ EXCEPTIONS OTHERS = 4 ).
244+ IF sy -subrc NE 0 .
245+ RAISE EXCEPTION TYPE cx_failed.
246+ ENDIF .
247+ ENDLOOP .
248+ ENDMETHOD .
229249ENDCLASS .
0 commit comments