Application Development 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: 

Event blocks

Former Member
0 Kudos

Hi Sapians ,

Actually i am bit confused about the concept of events .

so cn u please tell me ,What is the difference between event and processing block?

consider an example of report program .

START-OF-SELECTION .

SELECT MAX( prescrpt_id ) FROM zprescription INTO max_prescrption .

SELECT * FROM zprescription INTO TABLE itab_pr

WHERE prescrpt_id = max_prescrption .

READ TABLE itab_pr INTO WA_Pr WITH KEY

prescrpt_id = max_prescrption .

if WA_Pr-medicine1 = ENT6 AND

WA_Pr-medicine2 = ENT7 AND

WA_Pr-medicine3 = ENT8 AND

WA_Pr-medicine4 = ENT9 .

WRITE : 'YOUR DATA SAVED ALREADY .'.

flag2 = 1 .

My question is flag value is set first or first it calls the list processor and print the 'write/' statement .

Can i have a link of events ,so i can go thoroughly through this topic ?

With warm regards

Tarun

1 ACCEPTED SOLUTION

JozsefSzikszai
Active Contributor
0 Kudos

hi Tarun,

events are sun in a specific order, some people will surely copy the order here... What you ask here is slightly different. It happens so, that the system processes the WRITE statement and the list is processed in the background during program run (you can have a look at it in debugger), than the system processes the flag2 = 1. line. After the program finished, you'll get the complete list, which was built up during program run (remember you could have much more WRITE statements).

hope this helps

ec

3 REPLIES 3

JozsefSzikszai
Active Contributor
0 Kudos

hi Tarun,

events are sun in a specific order, some people will surely copy the order here... What you ask here is slightly different. It happens so, that the system processes the WRITE statement and the list is processed in the background during program run (you can have a look at it in debugger), than the system processes the flag2 = 1. line. After the program finished, you'll get the complete list, which was built up during program run (remember you could have much more WRITE statements).

hope this helps

ec

0 Kudos

Hi sir

Your answer solved my problem compeletely ,actually i saw the same during debugging .

But i want to ask that all my write statement Top-of-page and end-of-page are passed to background program or ?

and if we write something like that

WRITE / 'power' .

top-of-PAGE .

WRITE / ent1 .

INITIALIZATION .

ent1 = '009' .

START-OF-SELECTION .

select * INTO TABLE itab FROM zemp

WHERE Emp_id = ENT1 .

end-OF-SELECTION .

ent1 = '008' .

The output comes like

009

power

but according to event details

it must be like that

008

power

Sir you are really too good so can i have your email_id ?

With warm regards

Tarun

0 Kudos

there is a predefined order of the event blocks, that means it does not matter in which order do you write them in your program, SAP will do in the right order.

The order you can find in this thread:

ec