For testing purposes I need my ABAP program to wait for few seconds. How can this be done?
These event blocks are exited using STOP and the runtime environment raises the event END-OF-SELECTION. Note. The statement STOP cannot be used in methods and raises a non-handleable exception when processing dynpros called using CALL SCREEN, during a LOAD-OF-PROGRAM event, and in programs not called using SUBMIT.
ABAP is the programming language for SAP whereas Java is a programming language of SUN Microsystems. Seeing it from SAP perspective, the SAP R/3 system has a ABAP stack and a Java Stack.
ABAP is SAP's default programming language for both on-demand and on-premise business applications. Java is mostly used to run Java-based applications or services. ABAP is used to run ABAP based applications or services.
2 solutions:
1) Either use WAIT UP TO ... SECONDS.
WAIT UP TO 42 SECONDS.
WAIT UP TO '0.5' SECONDS. " decimals are possible since ABAP 7.40 SP 8
Use it when CPU processes are at a premium and when the implicit commit will not corrupt your data or cause a short dump because of an open database cursor.
2) Or use the function module ENQUE_SLEEP
:
CALL FUNCTION 'ENQUE_SLEEP'
EXPORTING
seconds = 42.
Use it when you cannot afford an implicit commit, and the system can handle the work process(es) being tied up for the duration of the SLEEP command.
ABAP WAIT UP TO SAP Documentation
WAIT statement has an implicit COMMIT which is something that should be avoided.
Do you really need it to pause? You could trace through it by entering /h into the transaction field before you execute the program or by setting a breakpoint in the code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With