Mitarbeiter
TYPE-POOLS: icon.
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive,
handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm,
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
DATA ls_toolbar TYPE stb_button.
CLEAR ls_toolbar.
MOVE 3 TO ls_toolbar-butn_type..
APPEND ls_toolbar TO e_object->mt_toolbar.
CLEAR ls_toolbar.
MOVE 'CHANGE' TO ls_toolbar-function.
MOVE icon_change TO ls_toolbar-icon.
MOVE 'Change SPFLI' TO ls_toolbar-quickinfo.
MOVE 'Change' TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD.
METHOD handle_user_command.
DATA lt_rows TYPE lvc_t_row.
DATA lt_row TYPE lvc_s_row.
CASE e_ucomm.
WHEN 'CHANGE'.
CALL METHOD my_alv->get_selected_rows
IMPORTING
et_index_rows = lt_rows.
IF lt_rows IS NOT INITIAL.
READ TABLE lt_rows INTO lt_row INDEX 1.
READ TABLE itab INTO zz00_spfli INDEX lt_row-index.
spfli-carrid = zz00_spfli-carrid.
spfli-connid = zz00_spfli-connid.
LEAVE TO SCREEN 100.
ENDIF.
ENDCASE.
ENDMETHOD.
METHOD handle_double_click.
READ TABLE itab INTO zz00_spfli INDEX e_row.
spfli-carrid = zz00_spfli-carrid.
spfli-connid = zz00_spfli-connid.
LEAVE TO SCREEN 100.
ENDMETHOD.
ENDCLASS.
DATA event_receiver TYPE REF TO lcl_event_receiver.
DATA: gs_layout TYPE lvc_s_layo.