Koray Tugay
Koray Tugay

Reputation: 23800

START-OF-SELECTION not triggered in ABAP?

I am studying this book and quoting from Chapter 5:

You are being introduced to the event START-OF-SELECTION. The first thing to understand about an event is to know when an event is triggered: that is, when program control jumps to the code under an event.

Scenario-I If there are no PARAMETERS statements in a program, pressing the function key F8 will begin the execution of the program starting from the first nondeclarative statement in the program.

In the scenario-I (no PARAMETERS statement/s) when the program is executed, control jumps to the event START-OF-SELECTION.

So here I have my sample code:

REPORT ZTMP_TEST_INNBOUND.

WRITE 'Hello World!'.

START-OF-SELECTION.
WRITE 'Big-Bang first..'.

And I am expecting that "Bing-Bang First" is printed first, but it is not the case.

Here is the output:

Hello World!
Big-Bang first..

Why is the output not the other way around? Is my understanding of what is explained in the book is wrong regarding START-OF-SELECTION ?

Upvotes: 1

Views: 2531

Answers (1)

Aleuskiris
Aleuskiris

Reputation: 161

Per SAP, in an executable program, any non-declarative statements that occur between the REPORT or PROGRAM statement and the first processing block are also processed in the START-OF-SELECTION block. So in your code example, the first write will execute and then the second one.

Here is a good reference

Upvotes: 7

Related Questions