CALL FUNCTION ... IN BACKGROUND TASK

CALL FUNCTION

-> this is being processed.

1. ... AS SEPARATE UNIT
2. ... DESTINATION dest
3. ... EXPORTING p1 = f1 ... pn = fn
4. ... TABLES p1 = itab1 ... pn = itabn

Effect

Flags the function module func to be run asynchronously. It is not executed at once, but the data passed with EXPORTING or TABLES is placed in a database table and the next COMMIT WORK executes it in another work process.

Note

This variant applies only as of Release 3.0, so both the client system and the server system must be Release 3.0.

Effect

Executes the function module in a separate LUW under a new transaction ID.

Effect

Executes the function module externally as a Remote Function Call (RFC); dest can be a literal or a variable.
Depending on the specified destination, the function module is executed either in another R/3 System or as a C-implemented function module. Externally callable function modules must be flagged as such in the Function Library (of the target system).
Since each destination defines its own program context, further calls to the same or different function modules with the same destination can access the local memory (global data) of these function modules.

Effect

EXPORTING passes values of fields and field strings from the calling program to the function module. In the function module, formal parameters are defined as import parameters. Default values must be assigned to all import parameters of the function module in the interface definition.

Effect

TABLES passes references to internal tables. All table parameters of the function module must contain values.

Notes


If several function module calls with the same destination are specified before COMMIT WORK, these normally form an LUW in the target system. Calls with the addition 1 are an exception to this rule - they each have their own LUW.
You cannot specify type 2 destinations (R/3 - R/2 connections).
Technical details
Administration transaction

Example

REPORT  RS41503F. 
 
/* This program performs a transactional RFC. 
 
TABLES: SCUSTOM. 
 
SELECT-OPTIONS: CUSTID FOR SCUSTOM-ID DEFAULT 1 TO 2. 
 
PARAMETERS: DEST LIKE RFCDES-RFCDEST DEFAULT 'NONE', 
			MODE DEFAULT 'N', 
			TIME LIKE SY-UZEIT DEFAULT SY-UZEIT. 
 
DATA: CUSTITAB LIKE CUST415 OCCURS 0 WITH HEADER LINE, 
	TAMESS   LIKE T100	OCCURS 0 WITH HEADER LINE. 
 
SELECT ID NAME TELEPHONE INTO CORRESPONDING FIELDS OF TABLE CUSTITAB 
			 FROM SCUSTOM WHERE ID IN CUSTID ORDER BY ID. 
 
PERFORM READ_CUSTITAB. 
 
EDITOR-CALL FOR CUSTITAB TITLE 'Editor for table CUSTITAB'. 
 
PERFORM READ_CUSTITAB. 
 
CALL FUNCTION 'TRAIN415_RFC_CALLTRANSACTION' 
	 IN BACKGROUND TASK 
	 DESTINATION DEST 
	 EXPORTING 
		TAMODE	= MODE 
	 TABLES 
		CUSTTAB   = CUSTITAB. 
 
CALL FUNCTION 'START_OF_BACKGROUNDTASK' 
	 EXPORTING 
		STARTDATE = SY-DATUM 
		STARTTIME = TIME 
	 EXCEPTIONS 
		OTHERS	= 1. 
 
IF SY-SUBRC = 1. 
  EXIT. 
ENDIF. 
 
COMMIT WORK. 
 
CALL TRANSACTION 'SM58'. 
*------------------------------------------------------------* 
*	 FORM READ_CUSTITAB								 * 
*------------------------------------------------------------* 
FORM READ_CUSTITAB. 
  WRITE: / 'System ID:', SY-SYSID. 
  SKIP. 
  LOOP AT CUSTITAB. 
	WRITE: / CUSTITAB-ID, CUSTITAB-NAME, CUSTITAB-TELEPHONE. 
  ENDLOOP. 
  ULINE. 
ENDFORM.