0% found this document useful (0 votes)
299 views2 pages

ABAP EXPORT Data TO MEMORY ID and Import It Back Again

Program 1 calls Program 2, which selects data from a table and exports it to memory using a memory ID based on the username. Program 1 then imports the data from memory using the same memory ID and displays it to the user. The import and export functionality allows sharing data between different SAP programs, reports, and web components.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
299 views2 pages

ABAP EXPORT Data TO MEMORY ID and Import It Back Again

Program 1 calls Program 2, which selects data from a table and exports it to memory using a memory ID based on the username. Program 1 then imports the data from memory using the same memory ID and displays it to the user. The import and export functionality allows sharing data between different SAP programs, reports, and web components.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

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.

Program 1 - Imports data from memory


*&--------------------------------------------------------------------
-*
*& Report ZPROG1
*&--------------------------------------------------------------------
-*
*&
*&--------------------------------------------------------------------
-*
REPORT ZPROG1.

data: it_lfa1prog1 type STANDARD TABLE OF lfa1,


wa_lfa1 type lfa1.

**********************************************************************
**
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.

*Just for clarification if the the following lines of code were


*implemented it would pass a syntax check but would not retrieve any
*data as the importing field name is different to that exported.
***import it_data to it_lfa1prog1 from memory id sy-uname.
***import it_lfa1 to it_lfa1prog1 from memory id sy-uname.

*Display data
LOOP AT it_lfa1prog1 INTO WA_LFA1.
write:/ WA_LFA1-LIFNR.
ENDLOOP.

Program 2 - Exports data to memory


&---------------------------------------------------------------------
*
*& Report ZPROG2
*&--------------------------------------------------------------------
-*
*&
*&--------------------------------------------------------------------
-*
REPORT ZPROG2.

data: it_lfa1prog2 type STANDARD TABLE OF lfa1.

**********************************************************************
**
START-OF-SELECTION.

* Select data
select *
UP TO 10 rows
from lfa1
into table it_lfa1prog2.

*Export data to memory using sy-uname as memory ID. When importing


this
*data elsewhere you need to reference this same variable name.
EXPORT it_lfa1prog2 to MEMORY ID sy-uname.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy