SAP EVENTS ABAP Statements



Get Example source ABAP code based on a different SAP table
  


ID EVENTS
• EVENTS ABAP Statement

EVENTS
Short Reference

ABAP_SYNTAX
EVENTS evt $[EXPORTING parameters$].

ABAP Addition
... EXPORTING parameters

What does it do?
This statement declares an instance event evt in a class or interface. The naming conventions apply to the name evt. The statement RAISE EVENT can be used to raise the instance event evt in any instance method of the same class, or of any class that implements the interface, as well as in the instance methods of subclasses if they are visible there.
• EXPORTING EVENTS

ABAP Addition

What does it do?
The addition EXPORTING defines the parameter interface of the event evt. An event can only have output parameters parameters that are passed by value.
When an event handler is declared using the addition FOR EVENT OF of the statement METHODS or CLASS-METHODS, the output parameters of the event are defined as the input parameters of the event handler. The properties of the input parameters are transferred from the output parameters defined in EVENTS.
• sender EVENTS
In addition to the output parameters defined explicitly using EXPORTING, each instance event has an implicit output parameter, sender. This output parameter has the type reference variable. When the event is raised using RAISE EVENT, the reference to the raising object is implicitly assigned to sender.
The static type of the input parameter sender is defined for every event handler by the object type (class or interface) that is specified after the addition FOR EVENT OF of the statement METHODS or CLASS-METHODS.



Latest notes:

The dynamic type of the implicit formal parameter sender is always the class of the object in which the event is raised.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
In the interface window, three events are declared, each with an explicit non-optional output parameter status. The class dialog_window implements the interface window. The interface window_handler contains event handlers, which import both the explicit parameters and the implicit parameter sender. The static type of the input parameter sender is the class dialog_window .
ABEXA 00238
ABAP_EXAMPLE_END

ABAP_EXAMPLE_ABEXA
Events in Inheritance
ABAP_EXAMPLE_END

Return to menu