ABAP Keyword Documentation → ABAP − Reference → Program Flow Logic → Control Structures → Program Interruption
WAIT UP TO
Other versions: 7.31 | 7.40 | 7.54
Syntax
WAIT UP TO sec SECONDS.
Effect
This statement interrupts the execution of the program by the number of seconds specified in sec
. sec
is a
numerical expression
position of operand type f
to which positive numbers (including 0) can
be passed. The unit of the number in sec
is seconds and the time resolution
is one millisecond. After the specified time has passed, the program continues with the statement following WAIT
. When used, this statement always changes the
work process.
Return Codes
This statement always sets sy-subrc
to 0.
Notes
-
Each time this variant of the statement
WAIT
is used, a database commit is triggered (except in updates). For this reason,WAIT
must not be used between ABAP SQL statements that open or close a database cursor. -
The variants
WAIT FOR ASYNCHRONOUS TASKS
,WAIT FOR MESSAGING CHANNELS
, andWAIT FOR PUSH CHANNELS
of this statement are useful only when used in combination with callback routines in aRFC, AMC, or APC. The variant shown here does not wait for callback routines.
Example
The output of the following example should correspond to approximately one million microseconds.
GET RUN TIME FIELD DATA(t1).
WAIT UP TO 1 SECONDS.
GET RUN TIME FIELD DATA(t2).
cl_demo_output=>display( |{ t2 - t1 STYLE = scientific }| ).
Exceptions
Non-Handleable Exceptions
-
Cause: Negative time specified for
sec
.
Runtime error:WAIT_ILLEGAL_TIME_LIMIT