Any ABAP programs that have their own screens (that is, executable programs, module pools or function groups) can be called externally in their own internal session and with their own SAP LUW.
Each time a program is called using SUBMIT or using transaction codes, a new internal session is opened, triggering the event LOAD-OF-PROGRAM.
You can directly call an executable program using the statement:
SUBMIT prog ... [AND RETURN].
If you omit the AND RETURN addition, the system terminates the calling program and calls the new executable program prog. The internal session of the calling program is replaced by the internal session of the new program. When the new program has finished, control returns to the point from which the calling program was started.
If you use the AND RETURN addition, the executable program prog is started in a new session. The internal session of the calling program is returned, and control returns to the calling program after the new program has finished.
You can assign a transaction code to any screen of a program. Normally, you assign a transaction code to a single screen in a module pool. This then allows you to start the program using one of the statements
LEAVE TO TRANSACTION tcode ...
or
CALL TRANSACTION tcode ...
The program starts by processing the screen that you specified when you defined the transaction code. This is called the initial screen.
If you use LEAVE TO TRANSACTION, the calling program is terminated. All previous internal sessions are deleted from the batch. At the same time, the ABAP memory is deleted with the result that you cannot pass any data using EXPORT/IMPORT TO MEMORY if you use LEAVE TO TRANSACTION. A new internal session is created for the program called. Once you exit the program called, the system returns to the area menu in which the first program of the batch was started. If you use LEAVE TO TRANSACTION SPACE, the system destroys the batch and returns directly to the area menu.
If you use CALL TRANSACTION, the programm called is started in a new session. The session of the calling program is retained. When the new program has finished, control returns to the point from which the calling program was started.
To leave a program that you have called, use the ABAP statement
LEAVE PROGRAM.