Professional Documents
Culture Documents
ABAP EXPORT Data TO MEMORY ID and Import It Back Again
ABAP EXPORT Data TO MEMORY ID and Import It Back Again
The import and export data to memory ID command allows you to pass data between
different sap programs, reports, bsp's, web dynpros etc. The below is the ABAP code
for 2 reports, one gets the data and stores in memory and the other retrieves this data
from memory and displays it to the user.
In this example program 1 calls program 2 which selects the data and stores it in
memory a ID based on the user name (sy-uname). Processing then returns to program 1
where it imports the data from memory into a local itab and displays the data to the user.
**********************************************************************
**
START-OF-SELECTION.
*Clear memory id
FREE MEMORY ID sy-uname.
*Execute Program 2
submit ZPROG2 and return.
**********************************************************************
**
END-of-SELECTION.
*Import data from memory. Although the import statement must
refrerence
*the same variable name the data was export with, the the local
*itab(it_lfa1prog2) where data is being imported too can have a
*different name (i.e. it_lfa1prog1).
import it_lfa1prog2 to it_lfa1prog1 from memory id sy-uname.
*Display data
LOOP AT it_lfa1prog1 INTO WA_LFA1.
write:/ WA_LFA1-LIFNR.
ENDLOOP.
**********************************************************************
**
START-OF-SELECTION.
* Select data
select *
UP TO 10 rows
from lfa1
into table it_lfa1prog2.