SAP EVENT BLOCKS



Get Example source ABAP code based on a different SAP table
  



Event Blocks
Event blocks are used to handle events in the ABAP runtime framework. They are introduced by an event key word and ended by the next processing block. Since there is no closing statement, it is recommended that the end of an event block is indicated with a comment line.
Within an event block, no local data types or data objects can be declared. All declarative statements in event blocks are part of the global data declarations of the ABAP program, and are visible in all subsequent processing blocks. An event block works with the global data types and data objects of the compilation unit, and therefore should not contain any separate declarations. ABAP_EXCEPTION The event blocks AT SELECTION-SCREEN ... and GET ..., which are implemented internally as procedures and can contain local data.
For reasons of data encapsulation, it is recommended that only very few functions are implemented in event blocks, and to call methods instead.
The following are the possible events:
Program constructor event
BEGIN_SECTION VERSION 5 OUT This event occurs in all program types, except for class pools and interface pools.
Reporting events These events only occur in executable programs.
END_SECTION VERSION 5 OUT
Selection screen and list events occur during selection screen processing or list processing.

ABAP_PGL
No implementations in dialog modules and event blocks
ABAP_PGL_END



Latest notes:

NON_V5_HINTS
At the end of each event block execution, the statement NEW-LINE is executed implicitly.
With the exception of AT SELECTION-SCREEN ... and GET ... , event blocks can be specified multiple times in a program. The event block START-OF-SELECTION can also implicitly exist more than once. When an event occurs, all associated event blocks are executed in the order of their occurrence. Event blocks that are explicitly specified multiple times produce a warning from the extended program check.
ABAP_HINT_END