Calling ABAP Programs Internally
From a user perspective there are two ways of starting programs: direct execution using the program name for executable programs, or selecting a transaction code for module pools. These two ways of calling programs can also be performed in ABAP programs that are already running. We have mentioned the relevant SUBMIT statement for executable programs. The corresponding statements for transactions are LEAVE TO TRANSACTION and CALL TRANSACTION. We can distinguish program calls from other ABAP programs by whether the calling program is being canceled completely or whether the called program is embedded in the calling program.
Canceling the calling program completely
You cancel the calling program completely by calling another program with SUBMIT prog.
or
LEAVE TO TRANSACTION transaction_code
When the SUBMIT statement is executed, the calling program is deleted from memory along with all its data. When the called program is ended the program execution returns to the point at which the calling program was started. This point can be a previous program in the call sequence.
When the LEAVE TO TRANSACTION statement is executed, all previous programs in the call sequence are deleted from memory along with their data, besides the calling program. When the called program is ended the program execution returns to the point at which the first program of the call string was started.
We will also encounter the LEAVE statement in other contexts. A LEAVE statement is used to quit a program context completely and the execution does not return to the statement directly after this point. Although LEAVE can be used without additions, we recommend using LEAVE always with an addition, such as TO TRANSACTION seen here. Otherwise it is often difficult to predict where the program execution will actually branch to at runtime, since the behavior depends on the call mode of the current program
Embedding the called program in the calling program
You can temporarily quit the calling program by calling another program with SUBMIT prog AND RETURN.
or
CALL TRANSACTION transaction_code.
In both cases, the calling program remains in memory with all its data. When the called program is terminated the program execution returns to the statement directly after the call location.
We will also see more of the CALL statement. CALL is the most important statement for temporarily quitting a program context in ABAP to execute another program unit. When the called unit is ended correctly the program returns behind the calling location.
If you like this post, you may as well like these too:
- ABAP Programs: Calling a function REPORT ZSOURCE1010.* Variable for later useDATA: X TYPE I VALUE 5, Y LIKE X VALUE 7, MAXIMUM LIKE X.* Calling a functionCALL FUNCTION ‘MAX_TEST’ EXPORTING A = X B =...
- Calling BAPI from Visual Basic(VB) In this exercise you will learn about logging onto the SAP system and you will also use a BAPI and create a sales order in SAP. All without logging onto...
- Calling an Unauthorised transaction Did you ever have the need to run a transaction and SAP ditched you by saying…’You are not authorized to use transaction <Transaction>’. This neat little trick will help you...
- ABAP Source Code: Syntax of ABAP/4 Programs 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 * Declaration...
- ABAP Programs: Importing from the ABAP/4 Memory REPORT ZSOURCE1402. * Internal tables which will be imported DATA: ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER LINE, ALL_BOOKINGS LIKE BOOKINGS OCCURS 10 WITH HEADER LINE, NEW_BOOKINGS LIKE BOOKINGS OCCURS...
- ABAP Programs: Exporting to the ABAP/4 Memory REPORT ZSOURCE1401. * Work areas TABLES: CUSTOMERS, BOOKINGS. * Internal tables which will be exported DATA: ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER LINE, ALL_BOOKINGS LIKE BOOKINGS OCCURS 10 WITH...
- Ending ABAP Programs The execution of an ABAP program is always ended when the corresponding process in the runtime environment ends. From an ABAP programmer’s perspective, this is when the last of the...
- ABAP Programs for Beginners Here is the list of Programs available in the ABAP Master Code Book (PDF). How to define types and data objects A Few Simple Examples Working with database tables and...
- Some Cool Programs in ABAP and the link is :- http://www.kabai.com/abaps/q.htm...
- ABAP Programs: Using where clauses REPORT ZSOURCE1104.* Work areasTABLES: BOOKINGS, CUSTOMERS.* Internal tablesDATA CUSTOMER_ORDERS LIKE BOOKINGS OCCURS 100 WITH HEADER LINE.DATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER LINE.* Selecting data with a simple where...
- ABAP Programs: Using colors REPORT ZSOURCE0807. * Display the header using an appropriate color (grayish blue)WRITE ‘Header’ COLOR COL_HEADING. * Switch the standard colorFORMAT COLOR COL_TOTAL. * Make the color less brightWRITE / ‘total...
- Different types of ABAP Programs There are nine types of ABAP Programs in SAP: 1 Executable Programs (ABAP Reports) I INCLUDE Program M Module Pool/Dialogue programs S Sub-Routine Pool J Interface Pool K Class Pool...



















Leave a Reply