Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Events Triggered

Former Member
0 Likes
631

hi

guys i am not understand why the out put is 1,2,99.

please explain me

Events Triggered in the Order Dictated by the Driver Program

1 report ztx1702.

2 data f1 type i value 1.

3

4 end-of-selection.

5 write: / '3. f1 =', f1.

6

7 start-of-selection.

8 write: / '2. f1 =', f1.

9 f1 = 99.

10

11 initialization.

12 write: / '1. f1 =', f1.

13 add 1 to f1.

output:

1. f1 = 1

2. f1 = 2

3. f1 = 99

thanks

hi

guys i am not understand why the out put is 1,2,99.

please explain me

Events Triggered in the Order Dictated by the Driver Program

1 report ztx1702.

2 data f1 type i value 1.

3

4 end-of-selection.

5 write: / '3. f1 =', f1.

6

7 start-of-selection.

8 write: / '2. f1 =', f1.

9 f1 = 99.

10

11 initialization.

12 write: / '1. f1 =', f1.

13 add 1 to f1.

output:

1. f1 = 1

2. f1 = 2

3. f1 = 99

thanks

3 REPLIES 3
Read only

sreekanthgo
Contributor
0 Likes
553

Hi Sanjeev,

Order of events triggered in ABAP programming is..


•	INITIALIZATION
•	AT SELECTION-SCREEN
•	AT SELECTION-SCREEN ON <field> 
•	START-OF-SELECTION
•	TOP-OF-PAGE
•	END-OF-PAGE
•	END-OF-SELECTION

ABAP program will be executed in the above event order, with out depending on the order you write.

Your program execution will be like this..

1) It declares the f1 as the integer type value and initializes 1 to it.

2) It directly goes to the Intialization part and there you are printing f1 value which is 1.

So there the output will be 1.f1 = 1.

At step 13 It will add 1 to f1. so here your f1 value is 2.

3) It then goes to the Start-of-selection event.

Here you are again printing f1 value which is 2.

after printing f1 value you are assigning 99 to f1 so your f1 now becomes to 99.

4) It goes to End-of-selection part and again you are printing f1 value which is 99.

So your report output willbe like this..

1.f1 = 1.

2.f1 = 2.

3.f1 = 99.

Thanks,

Sreekanth.

Message was edited by: Sreekanth G

Message was edited by: Sreekanth G

Read only

sreekanthgo
Contributor
0 Likes
553

Please reward some points... if my answer was helpful to you..

Thanks,

Sreekanth

Read only

Former Member
0 Likes
553

Hi

See my example:

REPORT ZEVENT.

INITIALIZATION.

WRITE: / 'INITIALIZATION'.

START-OF-SELECTION.

WRITE: / 'START-OF-SELECTION'.

END-OF-SELECTION.

WRITE: / 'END-OF-SELECTION'.

TOP-OF-PAGE.

WRITE: / 'TOP-OF-PAGE'.

---> INITIALIZATION: it's triggered as soon as the program is loaded to be ran. So it's always the first event is triggered.

---> TOP-OF-PAGE: it's triggered as soon as a command to write something in the ABAP list is called. So it depends on where these command are called.

---> START-OF-SELECTION: it's the main part of the program, here there are all actions ahve to be run, it's triggered only if the user press F8 or F9.

---> END-OF-SELECTION: it's the end of program and triggere as soon as START-OF-SELECTION event ends.

So the output of my example will be:

TOP-OF-PAGE

INITIALIZATION

START-OF-SELECTION

END-OF-SELECTION

INITIALIZATION event is triggered and command WRITE is called, so TOP-OF-PAGE event is triggered, them the program back to INITIALIZATION and run START-OF-SELECTION and END-OF-SELECTION.

Max