Mentor SAP

Programs Called Within Programs

The two ways to call other ABAP programs on a synchronous basis from within a program are as follows:

 

Use SUBMIT <program> and SUBMIT <program> AND RETURN to call programs that can be executed (program type “1” = “executable program”).

 

Use CALL TRANSACTION '<TCODE>' and LEAVE TO TRANSACTION '<TCODE>' to call transactions.

 

For more details on SUBMIT, CALL TRANSACTION, and LEAVE TO TRANSACTION, refer to the keyword documentation integrated in the ABAP Editor.

 

 

Asynchronous Call of a Function Module

To call function modules asynchronously to execute processes in parallel, you must supply the call with the addition STARTING NEW TASK <task name>, where <task name> stands for the name of an individual for the new independent task in which the function module is processed.

 

Asynchronously called function modules are processed in parallel to and independent of the calling program. The output of the function module (addition RECEIVE RESULTS FROM FUNCTION) is received in a later processing phase of the calling program.

 

If you call function modules by using the addition STARTING NEW TASK <task name>, you must mark the function modules as capable of being called remotely (processing type “remote-capable module”) in their properties.

 

For more information, see the keyword documentation in the ABAP Editor for CALL FUNCTION.

 

 

LUW Logic in Program-Controlled Calls

Function modules and methods run in the same SAP LUW as the program that calls them.

 

Executable programs called by SUBMIT <program> AND RETURN or SUBMIT <program> and transactions called by CALL TRANSACTION '<TCODE>', or LEAVE TO TRANSACTION '<TCODE>' each run in a separate SAP LUW, that is, their update requests have separate update keys.

 

If you use SUBMIT <program> AND RETURN or CALL TRANSACTION '<TCODE>' , the system continues the SAP LUW of the calling program as soon as the called program is completed. The LUWs of calling and called programs run independently of one another. Update requests and subroutine calls that use the ON COMMIT addition each require an independent COMMIT WORK in the corresponding SAP LUW.

 

If you use SUBMIT <program> or LEAVE TO TRANSACTION '<TCODE>' , the SAP LUW of the calling program ends. If you do not conclude the update requests with COMMIT WORK before the program call, the system does not create a header for the related update key in the log. This means that the update work process does not execute the update process for these requests. The same rule applies to subroutines called with the addition ON COMMIT .

 

Hint: Calling a program with SUBMIT <program> ..., CALL TRANSACTION '<TCODE>', or LEAVE TO TRANSACTION '<TCODE>' involves an implicit DB commit. Therefore, all inline changes performed by a program are automatically committed if another executable program or transaction is called.

 

 

 

SAP LUWs for CALL TRANSACTION

If you call transactions with nested calls, each transaction needs its own COMMIT WORK because each transaction maps its own SAP LUW.

 

The same rule is true for executable programs that are called with SUBMIT <program> AND RETURN.

 

 

Call Mode in CALL TRANSACTION