SAP RAISE EVENT ABAP Statements

Get Example source ABAP code based on a different SAP table
  


Standard SAP Help for RAISE

RAISE EVENT

Short Reference
• RAISE EVENT ABAP Statement

ABAP_BASIC_FORM_2 RAISE EVENT evt [EXPORTING p1 = a1 p2 = a2 ...].

ABAP Addition
... EXPORTING p1 = a1 p2 = a2 ...

What does it do? 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.
• EXPORTING RAISE EVENT

ABAP Addition

What does it do? 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 to 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.



Latest 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 after EXPORTING.
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 ABAP Coding
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.



Runtime Exceptions
Non-catchable Exceptions
Reason for error:
RAISE EVENT statements nested too deeply.
Runtime error: RAISE_EVENT_NESTING_LIMIT

Return to menu