CALL FUNCTION func STARTING NEW TASK task
[DESTINATION {dest|{IN GROUP {group|DEFAULT}}}]
parameter_list
[{PERFORMING subr}|{CALLING meth} ON END OF TASK].
1. ... DESTINATION IN GROUP {group|DEFAULT}
2. ... {PERFORMING subr}|{CALLING meth} ON END OF TASK
Asynchronous call of a remote-enabled function module remote-enabled function module specified in func using the RFC interface. Use addition DESTINATION to specify a single destination in dest or use IN GROUP to specify a group of application servers. The latter supports parallel processing of several function modules. The calling program is continued after the CALL FUNCTION statement as soon as the remotely called function has been started in the target system, without waiting for its processing to be completed. Use PERFORMING and CALLING to specify callback routines for the takeover of events when the remotely called function is terminated. For func and dest, character-type data objects are destexpected.
If the destination is not specified and also not defined via the addition KEEPING TASK of the statement RECEIVE, then the destination "NONE" is used implicitly. When using destination "NONE", a new main mode is opened for the current user session. In a main mode generated with STARTING NEW TASK, system field sy-modno has the value 0. The asynchronous RFC does not support communication with external systems or programs in other programming languages.
For task, you must specify a character-type data object, which contains a task identifier for the called remote function module, which can be up to eight characters long and chosen at will. This task ID should be unique for each call; it is passed to the callback routines to identify the function. Every task ID defines its own RFC connection with its own context, so that for repeated calls of function modules of the same task ID, the global data of the respective function group can be accessed, provided that the connection still stands.
Note that you cannot exceed the maximum number of six main modes in dialog processing. Otherwise, an error message is triggered.
... DESTINATION IN GROUP {group|DEFAULT}
If ypu specify IN GROUP as the destination, you can execute several function modules in parallel on a predefined group of application servers of the current SAP system.
For group, you must specify a data object of type RZLLI_APCL from the ABAP Dictionary, which contains either the name of an RFC server group created in transaction RZ12 or is initial. When specifying DEFAULT or if group is initial, all currently available application servers of the current SAP system are used as the group. Within a program, you are only allowed to use one single RFC server group. At the first asynchronous RFC with the addition IN GROUP, the specified RFC server group is initialized. At each asynchronous RFC with the group specified, the best suited application server is automatically determined and the called function module is executed on this server.
If the function module cannot be executed on any of the application servers, because not enough resources are available at present, a predefined exception RESOURCE_FAILURE is triggered, to which, in addition to the other RFC exceptions, a return value can be assigned. With this exception, the addition MESSAGE is not allowed.
... {PERFORMING subr}|{CALLING meth} ON END OF TASK
Use this addition to specify either a subroutine subr or, as of release 6.20, a method meth as the callback routine, which is executed after terminating the asynchronously called function module. For subr, you must directly specify a subroutine of the same program. For meth, you can enter the same specifications as for the general method call.
The specified subroutine subr can have exactly one USING parameter of type clike. meth must be public and can have only one non-optional input parameter p_task of type clike. At the call, the RFC interface fills this parameter with the task ID of the remotely called function, which was specified at the call in task. In the subroutine subr or in the method meth, you can use the statement RECEIVE to receive the results of the remote function. In the callback routine, you are not allowed to execute statements that interrupt the program execution or terminate a SAP LUW. Statements for list output are not executed.
Prerequisite for the execution of the callback routine is that the calling program still exists in its
internal mode when the remote function is terminated. It is then executed at the next change of the
work process. If the program was terminated or lies on the stack as part of a
call sequence, the callback routine
is not executed. Use the statement WAIT to stop the program execution until certain or all callback routines have been executed.
The callback routine is not executed if the asynchronous call of the function module ended with an exception.