Code: Alles auswählen.
go_alv->set_table_for_first_display(
EXPORTING
i_save = 'A'
i_default = 'X'
is_layout = ls_layout
is_variant = ls_variant
CHANGING
it_outtab = gt_xxxx
it_fieldcatalog = gt_fieldcatalog
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4
).
DATA(lo_events) = NEW lcl_event_handler( ).
SET HANDLER lo_events->on_toolbar FOR go_alv.
SET HANDLER lo_events>on_user_command FOR go_alv.
CALL METHOD go_alv->set_toolbar_interactive( ).
WRITE: space.
Code: Alles auswählen.
CLASS lcl_event_handler DEFINITION FINAL.
PUBLIC SECTION.
METHODS:
on_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object,
on_user_command FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
* METHODS bind_view
* IMPORTING
* io_view TYPE REF TO lcl_view.
METHODS set_handler.
PROTECTED SECTION.
PRIVATE SECTION.
* DATA: mo_view TYPE REF TO lcl_view.
ENDCLASS.
CLASS lcl_event_handler IMPLEMENTATION.
METHOD on_toolbar.
DATA button TYPE stb_button.
CLEAR button.
button-function = 'XXX'.
button-quickinfo = 'XXXX'.
button-butn_type = 2.
button-disabled = abap_false.
button-text = 'XXX'.
APPEND button TO e_object->mt_toolbar.
ENDMETHOD.
METHOD on_user_command.
*BREAK-POINT gesetzt
ENDMETHOD.
ENDCLASS.
Folgende Benutzer bedankten sich beim Autor PeterPaletti für den Beitrag:
ABAPlerv