Geht hier ähnlich.Alexander D. hat geschrieben:Im Oo-ALV würde es ja über context_menu_request funktionieren, bei diesem hier finde ich nichts gescheites...
Code: Alles auswählen.
REPORT z_test_alv_context_menu.
TYPE-POOLS slis.
*Daten lesen
DATA gt_sflight TYPE TABLE OF sflight.
SELECT *
INTO TABLE gt_sflight
FROM sflight
UP TO 10 ROWS.
*Event registrieren
DATA: gt_event TYPE slis_t_event,
gw_event TYPE slis_alv_event.
gw_event-name = slis_ev_context_menu.
gw_event-form = 'CONTEXT_MENU'.
APPEND gw_event TO gt_event.
* ALV rufen
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = 'sflight'
it_events = gt_event
TABLES
t_outtab = gt_sflight.
*&---------------------------------------------------------------------*
*& Form CONTEXT_MENU
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM context_menu using e_object type ref to cl_ctmenu.
BREAK-POINT.
ENDFORM. "CONTEXT_MENU
Code: Alles auswählen.
*&---------------------------------------------------------------------*
*& Form CONTEXT_MENU
*&---------------------------------------------------------------------*
* Standardfunktionen aus-, benutzerdefinierte einblenden
*----------------------------------------------------------------------*
FORM context_menu USING e_object TYPE REF TO cl_ctmenu.
DATA: lit_fcodes TYPE ui_functions.
* Funktionen ausblenden
APPEND cl_gui_alv_grid=>mc_fc_filter TO lit_fcodes.
APPEND cl_gui_alv_grid=>mc_fc_find TO lit_fcodes.
APPEND cl_gui_alv_grid=>mc_fc_col_optimize TO lit_fcodes.
APPEND cl_gui_alv_grid=>mc_fc_detail TO lit_fcodes.
APPEND cl_gui_alv_grid=>mc_fc_unfix_columns TO lit_fcodes.
APPEND cl_gui_alv_grid=>mc_fc_loc_cut TO lit_fcodes.
APPEND cl_gui_alv_grid=>mc_fc_loc_paste TO lit_fcodes.
APPEND cl_gui_alv_grid=>mc_fc_loc_copy TO lit_fcodes.
CALL METHOD e_object->hide_functions
EXPORTING
fcodes = lit_fcodes.
*--------------------------------------------------------------------*
* eigene Funktionen einblenden
*--------------------------------------------------------------------*
CALL METHOD e_object->add_function
EXPORTING
fcode = 'REFRESH'
text = 'Anzeige aktualisieren'.
CALL METHOD e_object->add_separator.
CALL METHOD e_object->add_function
EXPORTING
fcode = 'LT11'
text = 'TA quittieren'.
* eigene Funktionen einblenden
CALL METHOD e_object->add_function
EXPORTING
fcode = 'MB1A'
text = 'Entnahme buchen'.
ENDFORM. "CONTEXT_MENU