Registering and Processing Events 
The event mechanism of the Control Framework allows you to use handler methods in your programs to react to events triggered by the control (for example, a double-click).
The following description has been generalized to apply to all custom controls. For more information specific to a particular control, refer to that control's documentation.
Assume you are working with a custom control that has the ABAP wrapper cl_gui_xyz.
DATA my_control TYPE REF TO cl_gui_xyz.
Define an internal table (type cntl_simple_events) and a corresponding work area (type cntl_simple_event).
DATA events TYPE cntl_simple_events.
DATA wa_events TYPE cntl_simple_event.
Now fill the event table with the relevant events. To do this, you need the event ID (event_id field). You can find this information in the Class Browser by looking at the attributes of the class cl_gui_xyz. You must also decide whether the event is to be a system event (appl_event = ' ') or an application event (appl_event = 'X').
wa_events-eventid = event_id.
wa_events-appl_event = appl_event.
APPEND wa_events TO events.
You must now send the event table to the frontend so that it knows which events it has to direct to the backend.
Syntax
CALL METHOD my_control->set_registered_events events = events.
To react to the events of you custom control, you must now specify a handler method for it. This can be either an instance method or a static method.
Define the (local) class definition for the event handler. To do this, specify the name of the handler method (Event_Handler). You need to look at the class for the custom control cl_gui_xyz in the Class Browser to find out the name of the event (event_name) and its parameters (event_parameter). There is also a default event parameter sender, which is passed by all events. This contains the reference to the control that triggered the event.
Syntax
CLASS lcl_event_receiver DEFINITION. PUBLIC SECTION. METHODS Event_Handler FOR EVENT event_name OF cl_gui_xyz IMPORTING event_parameter sender. ENDCLASS.
Register the handler methods with the ABAP Objects Control Framework for the events.
Syntax
DATA event_receiver TYPE REF TO lcl_event_receiver. CREATE OBJECT event_receiver. SET HANDLER event_receiver->Event_Handler FOR my_control.
Define the (local) class definition for the event handler. To do this, specify the name of the handler method (Event_Handler). You need to look at the class for the custom control cl_gui_xyz in the Class Browser to find out the name of the event (event_name) and its parameters (event_parameter).
Syntax
CLASS lcl_event_receiver DEFINITION. PUBLIC SECTION. CLASS-METHODS Event_Handler FOR EVENT event_name OF cl_gui_xyz IMPORTING event_parameter sender. ENDCLASS.
Register the handler methods with the ABAP Objects Control Framework for the events.
Syntax
SET HANDLER lcl_event_receiver=>Event_Handler FOR my_control.
You define how you want the system to react to an event in the implementation of the handler method.
Syntax
CLASS lcl_event_receiver IMPLEMENTATION. METHOD Event_Handler. * Event processing ENDMETHOD ENDCLASS.
If you registered your event as an application event, you need to process it using the method CL_GUI_CFW=>DISPATCH. For further information, refer to Event Handling.