ABAP - Keyword Documentation →  ABAP - Programming Language →  Program Structure →  Modularization Statements →  Event Blocks →  Reporting Events → 
Mail Feedback

START-OF-SELECTION

Short Reference

Syntax

START-OF-SELECTION.

Effect

This event keyword defines the standard processing block of an executable program. The associated event is raised by the ABAP runtime framework during the processing of an executable program after selection screen processing of any standard selection screen.

In an executable program, the following statements are assigned to an implicit START-OF-SELECTION event block, which is inserted before any explicit START-OF-SELECTION event block if one exists:

Hint

If the program is linked to a logical database, preparatory work can be performed in START-OF-SELECTION before the logical database reads data. If the program is not linked to a logical database, this event block represents a main program, so to speak, from which procedures or classic screens are called.

Example

The following program section shows the recommended use of START-OF-SELECTION in an executable program. A dedicated method is called instead of a function implementation.

REPORT ...

CLASS cls DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS main.
ENDCLASS.

CLASS cls IMPLEMENTATION.
  METHOD main.
    ...
  ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.
  cls=>main( ).

Example

The following three executable programs all have the same functionality:

The first program contains an explicit event block START-OF-SELECTION and shows the recommended arrangement.

REPORT ...

DATA text TYPE string.

START-OF-SELECTION.
  text = `Hello World!`.
  cl_demo_output=>display_data( text ).

In the second program, there is an assignment before the first processing block, which constructs a second implicit event block START-OF-SELECTION before the explicit event block.

REPORT ...

DATA text TYPE string.

text = `Hello World!`.

START-OF-SELECTION.
  cl_demo_output=>display_data( text ).

In the third program, there is no explicit processing block. All statements implicitly construct the event block START-OF-SELECTION.

REPORT ...

DATA text TYPE string.

text = `Hello World!`.
cl_demo_output=>display_data( text ).

The third program has the same meaning as the first program. The second program, however, would have the following form if expressed explicitly:

REPORT ...

DATA text TYPE string.

START-OF-SELECTION.
  text = `Hello World!`.

START-OF-SELECTION.
  cl_demo_output=>display_data( text ).