ALV Tree
Programm
*&---------------------------------------------------------------------*
*& Report BCALV_TREE_DEMO *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT yatbkp_tree.
CLASS cl_gui_column_tree DEFINITION LOAD.
CLASS cl_gui_cfw DEFINITION LOAD.
DATA tree1 TYPE REF TO ycl_gui_alv_tree.
DATA mr_toolbar TYPE REF TO cl_gui_toolbar.
DATA: go_alv_1 TYPE REF TO cl_salv_table.
DATA: gx_msg TYPE REF TO cx_salv_msg.
DATA: go_dock TYPE REF TO cl_gui_docking_container.
INCLUDE <icon>.
INCLUDE ycalv_toolbar_event_receiver.
*INCLUDE YCALV_TREE_EVENT_RECEIVER.
DATA: toolbar_event_receiver TYPE REF TO lcl_toolbar_event_receiver.
DATA: gt_yatbkptree TYPE yatbkptree OCCURS 0, "Output-Table
gt_fieldcatalog TYPE lvc_t_fcat, "Fieldcatalog
ok_code LIKE sy-ucomm. "OK-Code
PARAMETERS: p_bp TYPE bu_partner DEFAULT '758538'.
START-OF-SELECTION.
END-OF-SELECTION.
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*& Module PBO OUTPUT
*&---------------------------------------------------------------------*
* process before output
*----------------------------------------------------------------------*
MODULE pbo OUTPUT.
SET PF-STATUS 'MAIN100'.
IF tree1 IS INITIAL.
PERFORM init_tree.
ENDIF.
CALL METHOD cl_gui_cfw=>flush.
ENDMODULE. " PBO OUTPUT
*&---------------------------------------------------------------------*
*& Module PAI INPUT
*&---------------------------------------------------------------------*
* process after input
*----------------------------------------------------------------------*
MODULE pai INPUT.
CASE ok_code.
WHEN 'EXIT' OR 'BACK' OR 'CANC'.
PERFORM exit_program.
WHEN OTHERS.
CALL METHOD cl_gui_cfw=>dispatch.
ENDCASE.
CLEAR ok_code.
CALL METHOD cl_gui_cfw=>flush.
ENDMODULE. " PAI INPUT
*&---------------------------------------------------------------------*
*& Form build_fieldcatalog
*&---------------------------------------------------------------------*
* build fieldcatalog for structure sflight
*----------------------------------------------------------------------*
FORM build_fieldcatalog.
* get fieldcatalog
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'YATBKPTREE'
CHANGING
ct_fieldcat = gt_fieldcatalog.
SORT gt_fieldcatalog BY scrtext_l.
* change fieldcatalog
DATA: ls_fieldcatalog TYPE lvc_s_fcat.
LOOP AT gt_fieldcatalog INTO ls_fieldcatalog.
CASE ls_fieldcatalog-fieldname.
WHEN 'BKPID1' OR 'BKPID2' OR 'BKPID3' OR 'BKPID4' OR 'BKPID5' OR 'BKPID6' OR
'TEXT1' OR 'TEXT2' OR 'TEXT3' OR 'TEXT4' OR 'TEXT5' OR 'TEXT6'.
ls_fieldcatalog-no_out = 'X'.
ls_fieldcatalog-key = ''.
WHEN 'BKPID'.
* ls_fieldcatalog-do_sum = 'X'.
ls_fieldcatalog-outputlen = '10'.
ENDCASE.
MODIFY gt_fieldcatalog FROM ls_fieldcatalog.
ENDLOOP.
ENDFORM. " build_fieldcatalog
*&---------------------------------------------------------------------*
*& Form build_hierarchy_header
*&---------------------------------------------------------------------*
* build hierarchy-header-information
*----------------------------------------------------------------------*
* -->P_L_HIERARCHY_HEADER strucxture for hierarchy-header
*----------------------------------------------------------------------*
FORM build_hierarchy_header CHANGING p_hierarchy_header TYPE treev_hhdr.
p_hierarchy_header-heading = 'Hierarchy Header'. "#EC NOTEXT
p_hierarchy_header-tooltip = 'This is the Hierarchy Header !'. "#EC NOTEXT
p_hierarchy_header-width = 90.
p_hierarchy_header-width_pix = ''.
ENDFORM. " build_hierarchy_header
*&---------------------------------------------------------------------*
*& Form exit_program
*&---------------------------------------------------------------------*
* free object and leave program
*----------------------------------------------------------------------*
FORM exit_program.
CALL METHOD tree1->free.
LEAVE PROGRAM.
ENDFORM. " exit_program
*&---------------------------------------------------------------------*
*& Form build_header
*&---------------------------------------------------------------------*
* build table for html_header
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM build_comment USING
pt_list_commentary TYPE slis_t_listheader
p_logo TYPE sdydo_value.
DATA: ls_line TYPE slis_listheader.
*
* LIST HEADING LINE: TYPE H
CLEAR ls_line.
ls_line-typ = 'H'.
* LS_LINE-KEY: NOT USED FOR THIS TYPE
ls_line-info = 'Tree GB'. "#EC NOTEXT
APPEND ls_line TO pt_list_commentary.
* STATUS LINE: TYPE S
CLEAR ls_line.
ls_line-typ = 'S'.
ls_line-key = 'Geschäftspartner:'. "#EC NOTEXT
ls_line-info = p_bp. "#EC NOTEXT
APPEND ls_line TO pt_list_commentary.
CLEAR: ls_line.
ls_line-typ = 'S'.
* ls_line-key = 'Geschäftspartner:'. "#EC NOTEXT
* ls_line-info = sy-datum. "#EC NOTEXT
APPEND ls_line TO pt_list_commentary.
CLEAR: ls_line.
ls_line-typ = 'S'.
ls_line-key = 'Hinterlegte Felder'. "#EC NOTEXT
ls_line-info = '----------------------------------------------------------->'. "#EC NOTEXT
APPEND ls_line TO pt_list_commentary.
* ls_line-key = 'time'.
* ls_line-info = '2.00 pm'. "#EC NOTEXT
* APPEND ls_line TO pt_list_commentary.
** ACTION LINE: TYPE A
* CLEAR ls_line.
* ls_line-typ = 'A'.
** LS_LINE-KEY: NOT USED FOR THIS TYPE
* ls_line-info = 'actual data'. "#EC NOTEXT
* APPEND ls_line TO pt_list_commentary.
*
************** p_logo = 'ENJOYSAP_LOGO'. "'ENJOYSAP_LOGO'.
ENDFORM. "build_comment
*&---------------------------------------------------------------------*
*& Form create_hierarchy
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM create_hierarchy.
DATA: ls_yatbkptree TYPE yatbkptree,
lt_yatbkptree TYPE yatbkptree OCCURS 0.
DATA: lf_bkpid1 TYPE lvc_value,
lf_bkpid2 TYPE lvc_value,
lf_bkpid3 TYPE lvc_value,
lf_bkpid4 TYPE lvc_value,
lf_bkpid5 TYPE lvc_value,
lf_bkpid6 TYPE lvc_value.
DATA: lf_bkpid1k TYPE lvc_nkey,
lf_bkpid2k TYPE lvc_nkey,
lf_bkpid3k TYPE lvc_nkey,
lf_bkpid4k TYPE lvc_nkey,
lf_bkpid5k TYPE lvc_nkey,
lf_bkpid6k TYPE lvc_nkey.
DATA: lt_item_layout TYPE lvc_t_layi,
ls_item_layout TYPE lvc_s_layi.
DATA: ls_node TYPE lvc_s_layn.
* get data
SELECT * FROM yatbkptree INTO TABLE lt_yatbkptree.
* UP TO 2000 ROWS . "#EC CI_NOWHERE
SORT lt_yatbkptree BY bkpid1 bkpid2 bkpid3 bkpid4.
* add data to tree
LOOP AT lt_yatbkptree INTO ls_yatbkptree.
"Knoten lesen Stufe 1
ON CHANGE OF ls_yatbkptree-bkpid1.
"Lesen
* ls_item_layout-t_image = '@3P@'.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
ls_item_layout-style = cl_gui_column_tree=>style_intensifd_critical.
APPEND ls_item_layout TO lt_item_layout.
CLEAR: lt_item_layout, ls_item_layout.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
ls_item_layout-class = cl_gui_column_tree=>item_class_checkbox.
ls_item_layout-editable = 'X'.
APPEND ls_item_layout TO lt_item_layout.
lf_bkpid1 = |{ ls_yatbkptree-bkpid1 }| && | | && |{ ls_yatbkptree-text1 }|.
ls_node-n_image = space.
ls_node-exp_image = space.
CALL METHOD tree1->add_node
EXPORTING
i_relat_node_key = ''
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = lf_bkpid1
is_outtab_line = ls_yatbkptree
is_node_layout = ls_node
it_item_layout = lt_item_layout
IMPORTING
e_new_node_key = lf_bkpid1k.
ENDON.
"Knoten lesen Stufe 2
ON CHANGE OF ls_yatbkptree-bkpid2.
"Nur wen BKPID2 gefüllt ist durchführen
IF ls_yatbkptree-bkpid2 IS NOT INITIAL.
CLEAR: lt_item_layout, ls_item_layout.
* ls_item_layout-t_image = '@3Y@'.
ls_item_layout-style = cl_gui_column_tree=>style_intensifd_critical.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
APPEND ls_item_layout TO lt_item_layout.
CLEAR: lt_item_layout, ls_item_layout.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
ls_item_layout-class = cl_gui_column_tree=>item_class_checkbox.
ls_item_layout-editable = 'X'.
APPEND ls_item_layout TO lt_item_layout.
lf_bkpid2 = |{ ls_yatbkptree-bkpid2 }| && | | && |{ ls_yatbkptree-text2 }|.
DATA: lf_relat1 TYPE int4.
lf_relat1 = cl_gui_column_tree=>relat_last_child.
CALL METHOD tree1->add_node
EXPORTING
i_relat_node_key = lf_bkpid1k
i_relationship = lf_relat1
i_node_text = lf_bkpid2
is_outtab_line = ls_yatbkptree
* is_node_layout = ls_node
it_item_layout = lt_item_layout
IMPORTING
e_new_node_key = lf_bkpid2k.
ENDIF.
ENDON.
"Knoten lesen Stufe 3
ON CHANGE OF ls_yatbkptree-bkpid3.
"Nur wen BKPID3 gefüllt ist durchführen
IF ls_yatbkptree-bkpid3 IS NOT INITIAL.
CLEAR: lt_item_layout, ls_item_layout.
* ls_item_layout-t_image = '@3Y@'.
ls_item_layout-style = cl_gui_column_tree=>style_intensifd_critical.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
APPEND ls_item_layout TO lt_item_layout.
CLEAR: lt_item_layout, ls_item_layout.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
ls_item_layout-class = cl_gui_column_tree=>item_class_checkbox.
ls_item_layout-editable = 'X'.
APPEND ls_item_layout TO lt_item_layout.
lf_bkpid3 = |{ ls_yatbkptree-bkpid3 }| && | | && |{ ls_yatbkptree-text3 }|.
DATA: lf_relat2 TYPE int4.
lf_relat2 = cl_gui_column_tree=>relat_last_child.
CALL METHOD tree1->add_node
EXPORTING
i_relat_node_key = lf_bkpid2k
i_relationship = lf_relat2
i_node_text = lf_bkpid3
is_outtab_line = ls_yatbkptree
* is_node_layout = ls_node
it_item_layout = lt_item_layout
IMPORTING
e_new_node_key = lf_bkpid3k.
ENDIF.
ENDON.
"Knoten lesen Stufe 4
ON CHANGE OF ls_yatbkptree-bkpid4.
"Nur wen BKPID4 gefüllt ist durchführen
IF ls_yatbkptree-bkpid4 IS NOT INITIAL.
CLEAR: lt_item_layout, ls_item_layout.
* ls_item_layout-t_image = '@3Y@'.
ls_item_layout-style = cl_gui_column_tree=>style_intensifd_critical.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
APPEND ls_item_layout TO lt_item_layout.
CLEAR: lt_item_layout, ls_item_layout.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
ls_item_layout-class = cl_gui_column_tree=>item_class_checkbox.
ls_item_layout-editable = 'X'.
APPEND ls_item_layout TO lt_item_layout.
lf_bkpid4 = |{ ls_yatbkptree-bkpid4 }| && | | && |{ ls_yatbkptree-text4 }|.
DATA: lf_relat3 TYPE int4.
lf_relat3 = cl_gui_column_tree=>relat_last_child.
CALL METHOD tree1->add_node
EXPORTING
i_relat_node_key = lf_bkpid3k
i_relationship = lf_relat3
i_node_text = lf_bkpid4
is_outtab_line = ls_yatbkptree
* is_node_layout = ls_node
it_item_layout = lt_item_layout
IMPORTING
e_new_node_key = lf_bkpid4k.
ENDIF.
ENDON.
* set_item-Layout
* CLEAR: lt_item_layout, ls_item_layout.
* ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
* ls_item_layout-class = cl_gui_column_tree=>item_class_checkbox.
* ls_item_layout-editable = 'X'.
* APPEND ls_item_layout TO lt_item_layout.
*
* CLEAR ls_item_layout.
* ls_item_layout-fieldname = 'PLANETYPE'.
* ls_item_layout-alignment = cl_gui_column_tree=>align_right.
* APPEND ls_item_layout TO lt_item_layout.
*
*
* lf_bkpid3 = |{ ls_yatbkptree-bkpid5 }| && | | && |{ ls_yatbkptree-text5 }|.
*
* CLEAR: ls_node.
** DATA: ls_node TYPE lvc_s_layn.
* ls_node-n_image = space.
* ls_node-exp_image = space.
*
* CALL METHOD tree1->add_node
* EXPORTING
* i_relat_node_key = lf_bkpid4k "ersetzt
* i_relationship = cl_gui_column_tree=>relat_last_child
* is_outtab_line = ls_yatbkptree "ersetzt
* i_node_text = lf_bkpid5 "ersetzt
* is_node_layout = ls_node
* it_item_layout = lt_item_layout
* IMPORTING
* e_new_node_key = lf_bkpid5k.
ENDLOOP.
"setze den GP
tree1->set_gb( p_bp ).
"hole bereits angekreuzte checkboxen
tree1->set_checkbox( ).
* tree1->set_checkbox_initial( ).
* this method must be called to send the data to the frontend
CALL METHOD tree1->frontend_update.
ENDFORM. " create_hierarchy
*&---------------------------------------------------------------------*
*& Form register_events
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM register_events.
* define the events which will be passed to the backend
DATA: lt_events TYPE cntl_simple_events,
l_event TYPE cntl_simple_event.
* define the events which will be passed to the backend
l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_checkbox_change.
APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_header_click.
APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
APPEND l_event TO lt_events.
CALL METHOD tree1->set_registered_events
EXPORTING
events = lt_events
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH 'ERROR'. "#EC NOTEXT
ENDIF.
* set Handler
* data: l_event_receiver type ref to lcl_tree_event_receiver.
* create object l_event_receiver.
* set handler l_event_receiver->handle_node_ctmenu_request
* for tree1.
* set handler l_event_receiver->handle_node_ctmenu_selected
* for tree1.
* set handler l_event_receiver->handle_item_ctmenu_request
* for tree1.
* set handler l_event_receiver->handle_item_ctmenu_selected
* for tree1.
ENDFORM. " register_events
*&---------------------------------------------------------------------*
*& Form change_toolbar
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM change_toolbar.
* get toolbar control
CALL METHOD tree1->get_toolbar_object
IMPORTING
er_toolbar = mr_toolbar.
CHECK NOT mr_toolbar IS INITIAL.
* add Standard Button to toolbar (for Delete Subtree)
CALL METHOD mr_toolbar->add_button
EXPORTING
fcode = 'INSERT'
icon = '@17@'
butn_type = cntb_btype_button
text = 'Insert BP'
quickinfo = 'Add BP'. "#EC NOTEXT
* set event-handler for toolbar-control
CREATE OBJECT toolbar_event_receiver. "tEST
SET HANDLER toolbar_event_receiver->on_function_selected FOR mr_toolbar.
* set handler toolbar_event_receiver->on_toolbar_dropdown
* for mr_toolbar.
ENDFORM. " change_toolbar
*&---------------------------------------------------------------------*
*& Form init_tree
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM init_tree.
"=======================================================================
" ALV Dock Beginn
"=======================================================================
go_dock = NEW cl_gui_docking_container(
no_autodef_progid_dynnr = abap_true
side = cl_gui_docking_container=>dock_at_right
style = cl_gui_container=>ws_visible + cl_gui_container=>ws_thickframe + cl_gui_container=>ws_child
ratio = 30
caption = 'Datenausgabe'
name = 'CNT1' ).
* SELECT durch Verknüpfung über mehrere Tabellen
SELECT u~bkp_id,
a~text
INTO TABLE @DATA(gt_yabkp)
FROM yabkp AS u
INNER JOIN yatbkptreecalc AS a ON a~bkpid = u~bkp_id
WHERE u~partner = @p_bp.
TRY.
cl_salv_table=>factory( EXPORTING
r_container = go_dock
IMPORTING
r_salv_table = go_alv_1
CHANGING
t_table = gt_yabkp ).
go_alv_1->display( ).
CATCH cx_salv_msg INTO gx_msg.
MESSAGE gx_msg TYPE 'E'.
ENDTRY.
* CREATE OBJECT toolbar_event_receiver.
* toolbar_event_receiver->set_dock( go_dock ).
"=======================================================================
" ALV Dock Ende
"=======================================================================
"=======================================================================
" ALV Tree Beginn
"=======================================================================
"Erstelle Feldkatalog
PERFORM build_fieldcatalog.
"Erstellen container für alv-tree
DATA: l_tree_container_name(30) TYPE c,
l_custom_container TYPE REF TO cl_gui_custom_container.
l_tree_container_name = 'TREE1'.
CREATE OBJECT l_custom_container
EXPORTING
container_name = l_tree_container_name
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH 'ERROR'. "#EC NOTEXT
ENDIF.
"Erstelle tree control
CREATE OBJECT tree1
EXPORTING
parent = l_custom_container
node_selection_mode = cl_gui_column_tree=>node_sel_mode_multiple
item_selection = abap_true "YI3K118558
no_html_header = ''
no_toolbar = ''
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
illegal_node_selection_mode = 5
failed = 6
illegal_column_name = 7.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH 'ERROR'. "#EC NOTEXT
ENDIF.
"Erstelle Hierarchy-header
DATA l_hierarchy_header TYPE treev_hhdr.
PERFORM build_hierarchy_header CHANGING l_hierarchy_header.
"Erstelle info-table for html-header
DATA: lt_list_commentary TYPE slis_t_listheader,
l_logo TYPE sdydo_value.
PERFORM build_comment USING
lt_list_commentary
l_logo.
"Report id um Varianten zu Speichern
DATA: ls_variant TYPE disvariant.
ls_variant-report = sy-repid.
"Erstelle leeren tree-control
CALL METHOD tree1->set_table_for_first_display
EXPORTING
is_hierarchy_header = l_hierarchy_header
it_list_commentary = lt_list_commentary
i_logo = l_logo
******* i_background_id = 'ALV_BACKGROUND'
******* i_save = 'A'
is_variant = ls_variant
CHANGING
it_outtab = gt_yatbkptree "table must be emty !!
it_fieldcatalog = gt_fieldcatalog.
"Erstelle hierarchy
PERFORM create_hierarchy.
"Hinzufügen der Funktionscods in der Toolbar
PERFORM change_toolbar.
"Events Registrieren
PERFORM register_events.
*Optimier Spaltenbreite
* call method tree1->COLUMN_OPTIMIZE.
ENDFORM. " init_tree
Klasse
class YCL_GUI_ALV_TREE definition
public
inheriting from CL_GUI_ALV_TREE
final
create public .
public section.
data MV_GB type BU_PARTNER .
methods GET_GB
returning
value(RV_GB) type BU_PARTNER .
methods SET_GB
importing
!IV_GB type BU_PARTNER .
methods SET_CHECKBOX .
methods SET_CHECKBOX_INITIAL .
protected section.
data MT_CHECKED_ITEMS_MANUEL type LVC_T_CHIT .
private section.
ENDCLASS.
CLASS YCL_GUI_ALV_TREE IMPLEMENTATION.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method YCL_GUI_ALV_TREE->GET_GB
* +-------------------------------------------------------------------------------------------------+
* | [<-()] RV_GB TYPE BU_PARTNER
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD get_gb.
rv_gb = mv_gb.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method YCL_GUI_ALV_TREE->SET_CHECKBOX
* +-------------------------------------------------------------------------------------------------+
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD set_checkbox.
DATA: lt_item_layout TYPE lvc_t_laci,
ls_item_layout TYPE lvc_s_laci,
ls_tree_data TYPE yatbkptree.
FIELD-SYMBOLS: <ls_item_layout> LIKE LINE OF lt_item_layout.
LOOP AT mt_item_layout ASSIGNING FIELD-SYMBOL(<fs_item_layout>) WHERE fieldname = '&Hierarchy' AND
editable = 'X'.
"holle eine Zeile
me->get_outtab_line( EXPORTING
i_node_key = <fs_item_layout>-node_key
IMPORTING
e_outtab_line = ls_tree_data ).
"prüfe ob die Ls_tree_data in YABKP enthalten sind wenn ja setzte Checkbox
SELECT SINGLE * FROM yabkp
WHERE bkp_id = @ls_tree_data-bkpid AND
partner = @mv_gb
INTO @DATA(ls_yabkp).
IF ls_yabkp IS NOT INITIAL.
"setze die Checkbox
APPEND INITIAL LINE TO lt_item_layout ASSIGNING <ls_item_layout>.
<ls_item_layout>-fieldname = cl_gui_alv_tree=>c_hierarchy_column_name.
<ls_item_layout>-chosen = 'X'.
<ls_item_layout>-u_chosen = 'X'.
"ändere die Zeile
me->change_node( EXPORTING
i_node_key = <fs_item_layout>-node_key
i_outtab_line = ls_tree_data
it_item_layout = lt_item_layout
EXCEPTIONS
node_not_found = 1
OTHERS = 2 ).
* Append MT_CHECKED_ITEMS_MANUEL.
* "Checkbox zu den markierten aufnehmen
* DATA: ls_checked_items TYPE lvc_s_chit.
* ls_checked_items = VALUE #( nodekey = <fs_item_layout>-node_key
* fieldname = <fs_item_layout>-fieldname ).
*
* INSERT ls_checked_items INTO TABLE mt_checked_items.
* CLEAR: ls_checked_items.
ENDIF.
CLEAR: ls_yabkp.
ENDLOOP.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method YCL_GUI_ALV_TREE->SET_CHECKBOX_INITIAL
* +-------------------------------------------------------------------------------------------------+
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD set_checkbox_initial.
LOOP AT mt_item_layout ASSIGNING FIELD-SYMBOL(<fs_item_layout>).
"prüfe ob die Ls_tree_data Zeilen hat welche ein X in der Checkbox haben.
IF <fs_item_layout>-chosen = 'X' AND <fs_item_layout>-fieldname = '&Hierarchy' .
"Checkbox zu den markierten aufnehmen
DATA: ls_checked_items TYPE lvc_s_chit.
ls_checked_items = VALUE #( nodekey = <fs_item_layout>-node_key
fieldname = <fs_item_layout>-fieldname ).
READ TABLE mt_checked_items into data(ls) WITH TABLE KEY nodekey = <fs_item_layout>-node_key
fieldname = <fs_item_layout>-fieldname.
IF sy-subrc = 0.
MODIFY TABLE mt_checked_items FROM ls_checked_items.
ELSE.
INSERT ls_checked_items INTO TABLE mt_checked_items.
ENDIF.
CLEAR: ls_checked_items.
ENDIF.
ENDLOOP.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method YCL_GUI_ALV_TREE->SET_GB
* +-------------------------------------------------------------------------------------------------+
* | [--->] IV_GB TYPE BU_PARTNER
* +--------------------------------------------------------------------------------------</SIGNATURE>
method SET_GB.
Mv_gb = iv_gb.
endmethod.
ENDCLASS.