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

Is it Advisable to use wait in program ?

Former Member
0 Likes
671

Is is advisable to use 'wait' in programs ? I need to do a select on a table , that i just wrote ....If i dont do a wait in the program , the select returns blank...!!

Does this make a major performance setback in a program ?

clear bkpf.

clear bkpf2.

wait up to 2 seconds.

select single * from bkpf into bkpf where

belnr = belnr1 and bukrs = messtab-msgv2 .

if sy-subrc = 0.

if dist >= 2.

select single * from bkpf into bkpf2 where

bvorg = bkpf-bvorg and belnr <> belnr1 and gjahr = bkpf-gjahr.

if sy-subrc = 0.

write 😕 Cross Company doc num: ' , bkpf-bvorg color 5.

write 😕 'Posted In Company Code : ' , bkpf-bukrs color 5.

uline.

1 ACCEPTED SOLUTION
Read only

vyende
Active Participant
0 Likes
598

It is really your discretion. Are you trying to read a record that has "just" been added to the database? If so, the record may still be in the buffer (and not physically in the database) and the wait is justbuying you time. The problem is this may not work all the time (depending on the load and system timings). I would opt for Commit and Wait before Wait.

3 REPLIES 3
Read only

Former Member
0 Likes
598

Hi,

I don't think wait up to 2 seconds will cause major performance while waiting messtab-msgv2 value.

Is this inside loop statement?

Regards,

Ferry Lianto

Read only

vyende
Active Participant
0 Likes
599

It is really your discretion. Are you trying to read a record that has "just" been added to the database? If so, the record may still be in the buffer (and not physically in the database) and the wait is justbuying you time. The problem is this may not work all the time (depending on the load and system timings). I would opt for Commit and Wait before Wait.

Read only

Former Member
0 Likes
598

There are other better ways than WAIT.

Rob