ABAP Keyword Documentation → ABAP - Reference → Data Interfaces and Communication Interfaces → Remote Function Call → CALL FUNCTION - RFC → CALL FUNCTION - STARTING NEW TASK
WAIT UNTIL
Other versions: 7.31 | 7.40 | 7.54
Syntax
WAIT UNTIL log_exp [UP TO sec SECONDS].
Addition
Effect
This variant of the statement WAIT
is designed only for use after an
asynchronous RFC with callback routines. It
interrupts program execution for as long as the result of the logical expression log_exp
is incorrect. For log_exp
, an arbitrary
logical expression can be specified.
If the result of log_exp
is incorrect, the program waits until a callback
routine of a previous function that was called asynchronously was executed and then checks the logical
expression again. If the result of the logical expression is true or the callback routines of all functions
called asynchronously beforehand have been executed, program execution is continued with the statement following WAIT
:
Addition
... UP TO sec SECONDS
Effect
With the specification UP TO
, program interruption is limited to the seconds
specified in sec
as a maximum. For sec
, a data
object of type f
is expected that must contain a positive number. The unit
of the number entered in sec
is seconds and the time resolution is one millisecond.
After the specified time has passed at the latest, program execution is continued with the statement following WAIT
:
System Fields
sy-subrc | Meaning |
---|---|
0 | The logical condition log_exp was fulfilled. |
4 | No asynchronous function calls exist. |
8 | With specification of the addition UP TO , the maximum time was exceeded. |
Notes
-
If the logical expression is incorrect, the running program is stopped in its current state. After a
callback routine, all data objects that were not changed in the callback routine have the same value
as for the previous execution of the logical expression. Any methods called by functions within the logical expression are executed again during the next check.
The statement WAIT causes a change in the
work process, which is linked to rolling out and rolling in all loaded programs. For this reason, the time in sec should not be less than a second in order not to load the system with too frequent changing of the work process.
-
It is recommended that you program the time for executing the callback routine of an
asynchronous RFC always with
WAIT UNTIL
to avoid relying on the next implicit change in the work process. -
Every time the statement
WAIT
is used, a database commit is issued. For this reason,WAIT
must not be used between Open SQL statements that open or close a database cursor. -
There is also a variant of the statement
WAIT
that can be used independently of the asynchronous RFC.
Exceptions
Non-Catchable Exceptions
-
Cause: Negative time specification for
sec
.
Runtime Error:WAIT_ILLEGAL_TIME_LIMIT