Ansicht
Dokumentation

ABAPWAIT_UNTIL - WAIT UNTIL

ABAPWAIT_UNTIL - WAIT UNTIL

SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up   Vendor Master (General Section)  
This documentation is copyright by SAP AG.
SAP E-Book

WAIT FOR ASYNCHRONOUS TASKS

Short Reference



WAIT FOR ASYNCHRONOUS TASKS
         $[MESSAGING CHANNELS$]
         $[PUSH CHANNELS$]
         UNTIL log_exp $[UP TO sec SECONDS$].


Additions

1. ... MESSAGING CHANNELS

2. ... PUSH CHANNELS

3. ... UP TO sec SECONDS

Effect

This variant of the statement WAIT is designed 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 callback routine, the program waits until a callback routine of a previous function (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 resumed with the statement that follows WAIT.

  • If the new check on the result of the logical expression is false and the callback routines of the functions previously called asynchronously were not all executed, one of the remaining callback routines must be executed before the program resumes.

  • If the new check on the result of the logical expression is false and the callback routines of the functions previously called asynchronously were all executed, sy-subrc is set to 4 and the execution of the program is resumed 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 statements that open or close a database cursor.

System Fields

sy-subrc Meaning
0 The logical expression log_exp is true.
4 The logical expression log_exp is false. Also the current program 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.
8 The logical expression log_exp is false and when the addition UP TO was specified, the maximum time was exceeded.

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 methods called by functions within the logical expression are executed again during the next check.

Addition 1

... MESSAGING CHANNELS

Addition 2

... PUSH CHANNELS

Effect

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 in 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.

Addition 3

... UP TO sec SECONDS

Effect

If UP TO is specified, a maximum time sec can be specified in seconds and the statement waits for asynchronously called functions to be ended for this time. sec expects a data object of the type f that must contain a positive number. The unit of the number 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 resumed with the statement that follows WAIT.

Notes

  • If there are not 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, it does not mean that any outstanding callback routines are never executed. A change of the work process at a later time 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 no longer executed.

Exceptions

Non-Catchable Exceptions

  • Cause: Negative time specified for sec.
    Runtime Error: WAIT_ILLEGAL_TIME_LIMIT






Fill RESBD Structure from EBP Component Structure   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.

Length: 8896 Date: 20240418 Time: 161901     sap01-206 ( 126 ms )