ABAPCALL_FUNCTION_STARTING - CALL FUNCTION STARTING

ROGBILLS - Synchronize billing plans   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.

CALL FUNCTION - STARTING NEW TASK

Short Reference



Syntax

CALL FUNCTION func STARTING NEW TASK task
              [DESTINATION {dest|{IN GROUP {group|DEFAULT}}}]
              [{CALLING meth}|{PERFORMING subr} ON END OF TASK]
              parameter_list.

Additions

1. ... DESTINATION IN GROUP {group|DEFAULT}

2. ... {CALLING meth}|{PERFORMING subr} ON END OF TASK

Effect

Asynchronous call (aRFC) of a remote-enabled function module specified in func using theRFC interface. Use addition DESTINATION to specify a singledestination in dest or use IN GROUP to specify a group ofapplicationservers. The latter supports parallel processing of multiple function modules. The calling programis continued using the statement CALL FUNCTION, as soon as the remotely called function has beenstarted in the target system, without having to wait for its processing to be finished. Use CALLINGand PERFORMING to specify callback routines for the takeover of events when the remotely called function is terminated. func and dest expect character-like data objects.

If the destination is not specified and also not defined using the addition KEEPING TASK of thestatement RECEIVE,then the destination "NONE"is used implicitly. The asynchronous RFC does not support communication with external systems or programs written in other programming languages.

A character-like data object must be specified for task. This object must contain a freely definabletask ID with a maximum of eight digits for the remotely called function module. This task ID must beunique for each call, and is handed to the callback routines for identifying the function. Every task ID defines its own RFC connection with its owncontext, so thatfor repeated calls of function modules of the same task ID and with the same destination, the globaldata of the associated function group can be accessed if the connection is still available. (This isthe case, for example, if the PERFORMING or CALLING addition is used. For asynchronousRFC without a response (without the PERFORMING or CALLING addition), the RFC connection is closed immediately after the call.)

More Information

For more information on aRFC, see Asynchronous RFC (aRFC) in the SAP Library.

Notes

  • When screens are called during aRFC processing, additional main sessions are opened in the RFC client.Note that the maximum number of six main sessions cannot be exceeded; if there are more, an error message is displayed.

  • Asynchronous RFC triggers a database commit in the calling program. An sRFC during theupdate is an exception to this.

  • If multiple asynchronous RFCs with various destinations are removed in succession in a calling program,this automatically leads to the parallel processing of the function modules called. Since the relevantmanagement can lead to resource bottlenecks on both the client and the server, this kind of parallel processing is only recommended using the DESTINATION IN GROUP addition.


Addition 1

... DESTINATION IN GROUP {group|DEFAULT}

Effect

If you specify IN GROUP as the destination, this supports parallel execution of multiple function modules on a predefined group of application servers of the currentAS ABAP. This variant of aRFC is also known as parallel remote function call (pRFC).

For group, you must specify a data object of the type RZLLI_APCL from the ABAP Dictionary, one that is either initial, or one that includes the name of an RFC server group created in transactionRZ12. If DEFAULT is specified or if groupis initial, all currently available application servers of the current AS ABAP are used as the group.Only one RFC server group may be used within a program. During the first asynchronous RFC using theaddition IN GROUP, the specified RFC server group is initialized. For each asynchronous RFCwhere the group is specified, the most suitable application server is determined automatically, and the called function module is executed on this.

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 raised, to which, in addition to the otherRFC exceptions, a return code can be assigned. For this exception, the addition MESSAGE is not permitted.

Notes

  • The parallel processing of function modules with the addition IN GROUP makes optimal use of the available resources and is preferable to self-programmed parallel processing with explicitly specified destinations.
  • An application server that is used as part of an RFC server group for parallel processing must haveat least three dialog work processes, of which one is currently free. Other resources, such as requests in the queue, the number of system messages and so on, are also respected and must not exceed certainthreshold values.
  • To ensure that only those application servers that have enough resources are accessed, we recommend that you work with explicitly defined RFC server groups instead of working with the addition DEFAULT.
  • The function modules of the function group SPBT provide service functions for parallel processing, forexample, initialization of RFC server groups, determining the used destination, or temporarily removing an application server from an RFC server group.


Addition 2

... {CALLING meth}|{PERFORMING subr} ON END OF TASK

Effect

Use this addition to specify either a method meth or a subroutine subr as the callbackroutine executed after terminating the asynchronously called function module. For meth, you can enter the same specifications as for the generalmethod call, in particular dynamic specifications. For subr, you must specify a subroutine of the same program statically.

The method meth must be public, and can have only one non-optional input parameter p_task of type clike. The specifiedsubroutine subrcan have exactly one USING parameter of the type clike. In the call, the RFC interfacefills this parameter with the task ID of the remotely called function specified in the call in task.In the method meth or in the subroutine subr, you can use the statement RECEIVEto receive the results of the remote function. In the callback routine, no statements can be executed that interrupt the routine or that trigger an implicitdatabase commit. Class-based exceptions must be handled within the callback routine. Statements forlist output are not executed.

A prerequisite for the execution of the callback routine is that the calling program still exists in itsinternal mode when the remote function is terminated. It is then executed at the next change of thework process. If the program was terminated or is located on the stack as part of acallsequence, the callback routine is not executed. Use the statement WAITUNTIL to stop the program execution until certain callback routines or all callback routines have been executed.

Notes

  • For class-based exception handling, that is, if the EXCEPTIONSaddition is not specified, a RECEIVE statement must be executed in the callback routine.
  • If no RECEIVE statement is executed in the callback routine to receive the result of the remotefunction, the connection remains intact and implicitly behaves like the RECEIVEstatement with the KEEPING TASK addition. This implicit behavior is generally not desired.
  • We recommend that you program the time of execution of the callback routine using WAITUNTIL. This statement leads to an explicitly requested change in the work process and offersfurther control options. Only in exceptional cases should callback routines be executed for implicit changes to the work process, for example at the end of adialog step.






ROGBILLS - Synchronize billing plans   PERFORM Short Reference  
This documentation is copyright by SAP AG.


Length: 12545 Date: 20120518 Time: 200406     triton ( 375 ms )