ABAP memory is used to transfer data between different ABAP programs.
In real-time business operations we may need to call different reports and applications to execute particular operation.
The below is the basic example of passing data from one ABAP program to another ABAP program by using ABAP memory.
SUBMIT is a keyword which is used to call a executable program (ABAP program) from another program.
Syntax: SUBMIT REPORT NAME SELECTION SCREEN OPTIONS LIST OPTIONS JOB OPTIONS [AND RETURN]. " AND RETURN is an addition REPORT NAME - Must be a ABAP report name SELECTION SCREEN OPTIONS - USed to supply selection screen values LIST OPTIONS - Used to specify page size and output medium JOB OPTIONS - Used to shedule program for background processing. RETURN - When we use return the control will come back to base program after execution
EXPORT is a keyword which is used to export a value to a memory id.
IMPORT is a keyword which is used to import a value from a memory id .
Using ABAP memory in ABAP programs
In the below example we pass data from program1 ZSAPN_ABAP_MEMORY1 to program2 ZSAPN_ABAP_MEMORY2 and display result in program2.
Test1 with out RETURN keyword.
REPORT ZSAPN_ABAP_MEMORY1. PARAMETERS : P_INPUT TYPE CHAR10 . START-OF-SELECTION. EXPORT P_INPUT TO MEMORY ID 'TEST' . SUBMIT ZSAPN_ABAP_MEMORY2 . IF SY-SUBRC EQ 0. WRITE:/ 'Only trigger when submit and return'. ENDIF.
REPORT ZSAPN_ABAP_MEMORY2. DATA P_INPUT TYPE CHAR10. IMPORT P_INPUT FROM MEMORY ID 'TEST'. WRITE :/ P_INPUT .
Test2 add the keyword RETURN to first program.
REPORT ZSAPN_ABAP_MEMORY1. PARAMETERS : P_INPUT TYPE CHAR10 . START-OF-SELECTION. EXPORT P_INPUT TO MEMORY ID 'TEST' . SUBMIT ZSAPN_ABAP_MEMORY2 AND RETURN . IF SY-SUBRC EQ 0. WRITE:/ 'Only trigger when submit and return'. ENDIF.Test the above programs and find out the defference.