Get Example source ABAP code based on a different SAP table
Standard SAP Help for WAIT
Short Reference • WAIT UNTIL ABAP Statement
ABAP Syntax WAIT UNTIL log_exp [UP TO sec SECONDS].
ABAP Addition ... UP TO sec SECONDS
What does it do? This variant of the statement WAIT is designed only for use after an asynchronous RFC with callback routines. It interrupts the program execution for as long as the result of the logical expression log_exp is false. Any logical expression can be specified for log_exp.
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 following statement in WAIT: • UP TO SECONDS WAIT UNTIL
What does it do? Specifying UP TO restricts the program interruption to a maximum number of seconds, specified in sec. For sec, a data object of type f is expected that must contain a positive number. The unit of the number in sec is seconds and the time resolution is one millisecond. After the specified time period has passed at the very latest, the program execution continues with the statement following WAIT.
System Fieldssy-subrcMeaning 0The logical expression log_exp is true. 4No asynchronous function calls exist. 8With specification of the addition UP TO, the maximum time was exceeded.
Latest 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 when the logical expression was last evaluated. Any methods called by functions within the logical expression are executed again during the next check. The statement WAIT causes a switch in the work process, which is linked to the rollout and roll-in of all loaded programs. For this reason, the time in sec should not be set less than a second in order not to overload the system with too frequent changing of work processes. It is advisable that the time for executing the callback routine of an asynchronous RFC is always programmed using WAIT UNTIL to avoid relying on the next implicit change in the work process. Each time the statement WAIT is used, a database commit is performed. 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.