Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Program Layout →  Modularization Statements →  Event Blocks →  Reporting Events 

START-OF-SELECTION

Quick Reference

Other versions: 7.31 | 7.40 | 7.54

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 environment during the running of an executable program after any standard selection screens have been processed.

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

  • All statements that are not declaration and are listed before the first explicit processing block.
  • All functional statements in the program if it does not contain any explicit processing blocks,


Note

If the program is associated with a logical database, preparatory tasks can be performed in START-OF-SELECTION before the logical database imports the data. If the program is not associated with a logical database, this event block becomes a type of "main program" 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 either instead of a function being implemented.

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 work in exactly the same way:

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

REPORT test_start_of_selection. 

DATA text TYPE string. 

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

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

REPORT test_start_of_selection. 

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 construct the event block START-OF-SELECTION implicitly.

REPORT test_start_of_selection. 

DATA text TYPE string. 

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

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

REPORT test_start_of_selection. 

DATA text TYPE string. 

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

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