Get Example source ABAP code based on a different SAP table
ID WAIT-FOR • UNTIL WAIT FOR ASYNCHRONOUS TASKS • WAIT FOR ASYNCHRONOUS TASKS ABAP Statement
WAIT FOR ASYNCHRONOUS TASKS> Short Reference >
ABAP_SYNTAX WAIT FOR ASYNCHRONOUS TASKS $[MESSAGING CHANNELS>$] $[PUSH CHANNELS>$] UNTIL log_exp> $[UP TO sec SECONDS$].>
ABAP Addition 1 ... MESSAGING CHANNELS> 2 ... PUSH CHANNELS> 3 ... UP TO sec SECONDS>
What does it do? This variant of the statement WAIT> is intended only for use after an asynchronous RFC> with callback routines. Any logical expression> can be specified for log_exp>> after UNTIL >.
If the result of log_exp> is false and there is an asynchronous function call with a callback routine, the program waits until a callback routine> of a function previously called asynchronously has been executed and then checks the logical expression again:
If the new check on the result of the logical expression is true, sy-subrc> is set to 0 and the execution of the program is continued with the statement that follows WAIT>.
If the new check on the result of the logical expression is false and the callback routines of all functions previously called asynchronously have not yet been executed, one of the remaining callback routines must be executed before the program continues.
If the new check on the result of the logical expression is false and the callback routines of all functions previously called asynchronously were executed, sy-subrc> is set to 4 and the execution of the program continues with the statement that follows WAIT>.
If the result of log_exp> is false and there is no asynchronous function call with a callback routine, the execution of the program is not interrupted, regardless of the result of log_exp>, and sy-subrc> is set to the value 4.
If the logical expression is true, the execution of the program is not interrupted, regardless of whether there is a function call with a callback routine, and sy-subrc> is set to the value 0. If the statement WAIT> interrupts the program, the work process> is changed, and a database commit> is executed, except in updates>. For this reason, WAIT> must not be used between AB-SQL statements that open or close a database cursor>. System Fields> sy-subrc>>Meaning> 0The logical expression log_exp> is true. 4The logical expression log_exp> is false. The current ABAP_ISESS > also does not contain any asynchronous function calls with callback routines, and no receiver is registered for AMC> messages or APC> messages for the use of the additions MESSAGING CHANNELS> or PUSH CHANNELS>. 8The logical expression log_exp> is false and when the addition UP TO> was specified, the maximum time was exceeded.
Latest notes:
If the logical expression is false and there is an asynchronous function call with a callback routine, the statement WAIT FOR> changes the work process and hence executes all callback routines registered up until now.
When a program is interrupted, the running program is paused 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 functional method calls within the logical expression are executed again during the next check.
This statement has an obsolete short form> in which FOR ASYNCHRONOUS TASKS> is not specified. ABAP_HINT_END
ABAP Addition
ABAP Addition
What does it do? If these additions are specified, this variant of the statement WAIT > is combined with the variants WAIT FOR MESSAGING CHANNELS>> or WAIT FOR PUSH CHANNELS >>. The program flow described for the variants is added to the program flow described above. The WAIT> statement then also waits for AMC messages or APC messages to be executed and does not just wait for asynchronously called functions to be executed. • UP TO SECONDS WAIT FOR ASYNCHRONOUS TASKS
ABAP Addition
What does it do? If UP TO> is specified, a maximum time sec> can be specified in seconds while the statement waits for asynchronously called functions to be ended. sec> expects a data object of the type f > that must contain a positive number. The unit of the number specified in sec> is seconds and the time resolution is one millisecond. If none of the asynchronously called functions are ended within the specified time, their callback routine specifies that the result of the logical expression log_exp> is true, sy-subrc> is set to 8, and the execution of the program is continued with the statement that follows WAIT>.
Latest notes:
If there are no asynchronous function calls with a callback routine, the addition UP TO sec SECONDS> is ignored.
The addition UP TO sec SECONDS> is ignored with respect to the execution of the callback routines. The time needed for these routines to execute can be longer than the time specified.
If the addition UP TO sec SECONDS> is used to cancel the wait time , it does not mean that any outstanding callback routines are no longer executed at all. A later change of the work process in the same program can result in the callback routines of the asynchronous functions executed until now being executed. Only the callback routines of those asynchronous functions not ended at the end of the program are not executed. ABAP_HINT_END