Introduction
Use
Architecture
Explanation
When the control is set to its initial state, the SAPGUI filters all events triggered by the control on account of user actions. This prevents the connection to the application server from being excessively strained by permanent events such as mouse movements. Events can only be handled if you register selected events using methods of the instance created. The standard method used is SET_REGISTERED_EVENTS.
Once an event is triggered, the SAPGUI encodes this event in the OK code which is transferred by the frontend to the application server. An event triggered on the frontend first of all has nothing to do with ABAP Objects events. In order to initiate event handling for this event, the Control Framework must assign the event to the relevant instance and trigger the event.
There are two ways of processing the triggered event in the ABAP program:
-
The Control Framework triggers the event irrespective of the screen flow logic, that is, without processing the PAI and PBO events. These events are called system events. This type of event processing is the default setting.
-
The Control Framework processes the PAI module after an event. In this case, you must call method CL_GUI_CFW=>DISPATCH to initiate the event handling of ABAP Objects. These events are called application events.
The method that you linked to the event is then called automatically.
Conclusion
To process events triggered by a control, you must:
-
Register the events for the control instance to ensure they are not withheld by the SAPGUI.
-
Call static method DISPATCH in the PAI module for application events. This identifies the events transferred for processing and calls the appropriate event handler methods, if they exist.
-
Define a class with event handler methods. In the methods, you can get additional event information and affect control behavior.
-
Link the events of your control instance to the relevant event handler method. To do this, you use method SET HANDLER.