Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Export memory and Import memory

Former Member
0 Kudos

Hi all,

Pls help me by posting some good examples of Export memory id and import memory id concept.

Im in Field exit object where i've to export the available quantity in MIGO(erfmg) into one itab- field1(as temp storage) and import the same into a itab field 2 by memory-id concept.

Why i need this,i've to give a conditional range in between the qty.

Ex:

"Export itab from itab to memory id 'MID'."

"import itab to itab from memory id 'MID'."

hope u understand, and pls post me some good examples.

thanks & regards

sankar.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

-


Program1----


REPORT demo_program_rep3 NO STANDARD PAGE HEADING.

DATA: number TYPE i,

itab TYPE TABLE OF i.

SET PF-STATUS 'MYBACK'.

DO 5 TIMES.

number = sy-index.

APPEND number TO itab.

WRITE / number.

ENDDO.

TOP-OF-PAGE.

WRITE 'Report 2'.

ULINE.

AT USER-COMMAND.

CASE sy-ucomm.

WHEN 'MBCK'.

EXPORT itab TO MEMORY ID 'HK'.

LEAVE.

ENDCASE.

-


Program2----


REPORT demo_programm_leave NO STANDARD PAGE HEADING.

DATA: itab TYPE TABLE OF i,

num TYPE i.

SUBMIT demo_program_rep3 AND RETURN.

IMPORT itab FROM MEMORY ID 'HK'.

LOOP AT itab INTO num.

WRITE / num.

ENDLOOP.

TOP-OF-PAGE.

WRITE 'Report 1'.

ULINE.

-


end of program 2----


Now you copy this programs with same name as i mentioned and execute demo_programm_leave Program.you will understnad clearly.

Notes::: A logical memory model illustrates how the main memory is distributed from the view of executable programs. A distinction is made here between external sessions and internal sessions .

An external session is usually linked to an R/3 window. You can create an external session by choosing System/Create session, or by entering /o in the command field. An external session is broken down further into internal sessions. Program data is only visible within an internal session. Each external session can include up to 20 internal sessions (stacks).

Every program you start runs in an internal session.

To copy a set of ABAP variables and their current values (data cluster) to the ABAP memory, use the EXPORT TO MEMORY ID statement. The (up to 32 characters) is used to identify the different data clusters.

If you repeat an EXPORT TO MEMORY ID statement to an existing data cluster, the new data overwrites the old.

To copy data from ABAP memory to the corresponding fields of an ABAP program, use the IMPORT FROM MEMORY ID statement.

Regds

Sivaparvathi

Please reward points if helpful

Edited by: Siva Parvathi on Dec 28, 2007 2:30 PM

2 REPLIES 2

Former Member
0 Kudos

Hi,

-


Program1----


REPORT demo_program_rep3 NO STANDARD PAGE HEADING.

DATA: number TYPE i,

itab TYPE TABLE OF i.

SET PF-STATUS 'MYBACK'.

DO 5 TIMES.

number = sy-index.

APPEND number TO itab.

WRITE / number.

ENDDO.

TOP-OF-PAGE.

WRITE 'Report 2'.

ULINE.

AT USER-COMMAND.

CASE sy-ucomm.

WHEN 'MBCK'.

EXPORT itab TO MEMORY ID 'HK'.

LEAVE.

ENDCASE.

-


Program2----


REPORT demo_programm_leave NO STANDARD PAGE HEADING.

DATA: itab TYPE TABLE OF i,

num TYPE i.

SUBMIT demo_program_rep3 AND RETURN.

IMPORT itab FROM MEMORY ID 'HK'.

LOOP AT itab INTO num.

WRITE / num.

ENDLOOP.

TOP-OF-PAGE.

WRITE 'Report 1'.

ULINE.

-


end of program 2----


Now you copy this programs with same name as i mentioned and execute demo_programm_leave Program.you will understnad clearly.

Notes::: A logical memory model illustrates how the main memory is distributed from the view of executable programs. A distinction is made here between external sessions and internal sessions .

An external session is usually linked to an R/3 window. You can create an external session by choosing System/Create session, or by entering /o in the command field. An external session is broken down further into internal sessions. Program data is only visible within an internal session. Each external session can include up to 20 internal sessions (stacks).

Every program you start runs in an internal session.

To copy a set of ABAP variables and their current values (data cluster) to the ABAP memory, use the EXPORT TO MEMORY ID statement. The (up to 32 characters) is used to identify the different data clusters.

If you repeat an EXPORT TO MEMORY ID statement to an existing data cluster, the new data overwrites the old.

To copy data from ABAP memory to the corresponding fields of an ABAP program, use the IMPORT FROM MEMORY ID statement.

Regds

Sivaparvathi

Please reward points if helpful

Edited by: Siva Parvathi on Dec 28, 2007 2:30 PM

Former Member
0 Kudos

Hi,

import from

-


is a keyword which is used for abap memory to import data from one place and place it in another place. for ex in any transaction to get default values to fields we use this keyword.

export to -


> similar to above one but it is used for sending values from one place to another.

ex:

data: it_bkpf type table of bkpf with header line.

SELECT * FROM bkpf into table it_bkpf.

EXPORT it_bkpf[] TO MEMORY ID 'MID'.

refresh it_bkpf.

IMPORT it_bkpf[] FROM MEMORY ID 'MID'.

LOOP AT It_bkpf.

write:/ it_bkpf-belnr, 'found' color col_positive.

ENDLOOP.

Hope it is useful.

Thanks,

Sandeep.