首先宣告EVENT_RECEIVER
DATA: GRID TYPE REF TO CL_GUI_ALV_GRID,
EVENT_RECEIVER TYPE REF TO LCL_EVENT_RECEIVER.
再寫code,重點在event CONTEXT_MENU_REQUEST,將E_OBJECT清空
CLASS LCL_EVENT_RECEIVER DEFINITION.
PUBLIC SECTION.
METHODS:
HANDLE_CONTEXT_MENU_REQUEST FOR EVENT CONTEXT_MENU_REQUEST OF CL_GUI_ALV_GRID
IMPORTING E_OBJECT.
ENDCLASS.
PUBLIC SECTION.
METHODS:
HANDLE_CONTEXT_MENU_REQUEST FOR EVENT CONTEXT_MENU_REQUEST OF CL_GUI_ALV_GRID
IMPORTING E_OBJECT.
ENDCLASS.
CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
METHOD HANDLE_CONTEXT_MENU_REQUEST.
CALL METHOD E_OBJECT->CLEAR.
ENDMETHOD.
ENDCLASS.
METHOD HANDLE_CONTEXT_MENU_REQUEST.
CALL METHOD E_OBJECT->CLEAR.
ENDMETHOD.
ENDCLASS.
再來就是將event掛到grid去
CREATE OBJECT EVENT_RECEIVER.
SET HANDLER EVENT_RECEIVER->HANDLE_CONTEXT_MENU_REQUEST FOR GRID1.
SET HANDLER EVENT_RECEIVER->HANDLE_CONTEXT_MENU_REQUEST FOR GRID1.
沒有留言:
張貼留言