ABAP Keyword Documentation → ABAP - Reference → Calling and leaving program units → Calling Processing Blocks → Call Event Handler
RAISE EVENT
Other versions: 7.31 | 7.40 | 7.54
Syntax
RAISE EVENT evt [EXPORTING p1 = a1 p2 = a2 ...].
Addition
... EXPORTING p1 = a1 p2 = a2 ...
Effect
This statement can only be used in methods. It raises the event evt
.
evt is the name to be specified directly for an event that must be declared with the statement
EVENTS
or
CLASS-EVENTS
directly in the same class, in a superclass, or in an implemented interface.
After the event is triggered, all
event handlers that were registered for this event with the statement
SET HANDLER
are executed. The execution order is undefined and can change
while the program is being executed. After the event handlers have been executed, the system continues with the method after RAISE EVENT
.
Addition
... EXPORTING p1 = a1 p2 = a2 ...
Effect
If the addition EXPORTING
is used, actual parameters a1
a2 ... can be assigned to all optional formal parameters p1 p2...
of the event evt
and must be assigned to all non-optional formal parameters.
The values of the actual parameters are passed to the event handlers; the formal parameters are listed
after the addition IMPORTING
of the statements
[CLASS-]
EVENTS
.
a1
, a2
, ... are
general expression positions. In other words, functions and expressions can be passed as actual parameters, alongside data objects.
Special rules apply in this case.
Notes
-
To avoid endless recursion, a maximum of 1023 further events can be triggered with
RAISE EVENT
during event handling. -
If the formal parameter
sender
is defined for an event handler, this is automatically supplied with the reference to the triggering object when instance events are triggered. It cannot be specified explicitly afterEXPORTING
. -
If there is an exception in an event handler, event handling is canceled. For a class-based exception, the control is then returned to the trigger. See
Class-Based Exceptions in Event Handlers.
Example
Triggering an instance event e1
. An actual parameter must be assigned to the non-optional formal parameter p1
.
CLASS c1 DEFINITION.
PUBLIC SECTION.
EVENTS e1 EXPORTING value(p1) TYPE string
value(p2) TYPE i OPTIONAL.
METHODS m1.
ENDCLASS.
...
CLASS c1 IMPLEMENTATION.
METHOD m1.
...
RAISE EVENT e1 EXPORTING p1 = '...'.
...
ENDMETHOD.
ENDCLASS.
Exceptions
Non-Catchable Exceptions
-
Cause:
RAISE EVENT
statements nested too deeply.
Runtime error:RAISE_EVENT_NESTING_LIMIT