In Release 3.0, you can run function modules asynchronously at a specified destination. These function modules are not executed at once, but after a COMMIT WORK statement. Until then, the calls are stored in an internal table. For each destination, they form a Logical Unit of Work (LUW). When a COMMIT WORK statment occurs, all the calls are processed in order by the next free work process. For correct syntax, see the ABAP/4 online documentation.
The calls are stored in the tables ARFCSSTATE and ARFCSDATA. Each LUW is
distinguished by a worldwide unique ID (the transaction ID). You can read the
ID in the current program by calling the function module ID_OF_BACKGROUNDTASK
after the first CALL and before COMMIT WORK.
When a COMMIT WORK statement occurs, the calls specified under the transaction
ID are transferred to the relevant target system and executed there. The
system function module ARFC_DEST_SHIP manages the transfer of data. In the
target system, the data is processed by the function module ARFC_EXECUTE, i.e.
the flagged calls are executed. If one of the calls results in an error or
raises an exception, all the database operations started by the preceding
calls are cancelled (with ROLLBACK) and an appropriate error message is
written to the file ARFCSDATA. You can analyze this with Transaction SM58 and
also obtain a status report for a transaction ID by calling the function
module STATUS_OF_BACKGROUNDTASK.
If an LUW is successfully executed in the target system, the function module
ARFC_DEST_CONFIRM confirms this. Then, the appropriate entries are deleted in
ARFCSSTATE and ARFCSDATA.
If the target system cannot be accessed because the connection is not active,
the report RSARFCSE with the transaction ID is scheduled as a variant to be
run in the background and is called at regular intervals. You can determine
the call frequency and duration in the enhancements SABP0003 (call TA CMOD)
according to your own requirements. If no connection can be established for
some time, the entry in ARFCSSTATE is deleted after a time also defined by you
in the enhancements. Deletion follows background scheduling of the report
RSARFCDL.
You can also execute function modules asynchronously in 'C' (connection type TCP/IP in SM59). You implement them as usual with the RFC API. The function modules ARFC_DEST_SHIP and ARFC_DEST_CONFIRM which are stored in rfclib.o call the appropriate functions. This option is only available under Windows.