Passing data from one ABAP program to another
Introduction: Recently I have come across a very interesting & powerful concept in ABAP regarding ABAP memory, ABAP memory is a memory area that all ABAP programs within the same internal session can access using the EXPORT and IMPORT statements. The EXPORT TO MEMORY and IMPORT FROM MEMORY statements allow you to write data to, or read data from, the ABAP memory.
With the help of these we can pass the parameters between the programs.
Let's take a scenario where we need an internal table which is in program (let's say Prog_name) which contains some Employee verification data in respect of one personnel no. Now our requirement is to use the same internal table in our program, so we will first export the personnel no to a memory id.
------------------Passing value of perner to Memory ID 'Memo1'
Export pernr to MEMORY id 'Memo1'.
Now submit to the program
Submit Prog_name AND RETURN .------------------Now we are importing 'it_table' from Prog_name based on the value of pernr
Import it_table from MEMORY id 'ABC' . Now we have to add Export parameter code in target program (Prog_name).
import pernr from memory id 'Memo1' .---------------After the internal table is appended we need to export it to again memory id (Memo1)
export it_table to memory id 'Memo1' .