Application Development and Automation 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: 
Read only

export/import to memory

Former Member
0 Likes
3,519

hi,

how to export a variable to memory and import the same?

Regards,

Anil.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,434

Hi anilkumar,

1. U want the value of some variable xyz

from program 1,

into program 2.

2. We can use what u said.

3. Just make sure of the following things.

4. a) the variable name should be same

(in prog1, prog2)

b) The Declaration should also match

c) use export / import with the same name as variable

In prog1:

eg. DATA : MYVAR TYPE I.

EXPORT MYVAR TO MEMORY ID 'MYVAR'

In prog2:

eg. DATA : MYVAR TYPE I.

IMPORT MYVAR FROM MEMORY ID 'MYVAR'

5. Then it will work fine.

6. Moreover, u can check the value of

sy-subrc just after export/import

to know, whether it was successful or not.

regards,

amit m.

9 REPLIES 9
Read only

Former Member
0 Likes
2,434

There are two kinds of memory ..depending upon the volatility of data .. ABAP memory and SAP memory...

ABAP memory can be accessed through Keywords EXPORT and IMPORT

and SAP memory through parameter ids..

TO check out how to use this ..run transaction ABAP_DOCU_SHOW..and key in these keywords

Read only

Former Member
0 Likes
2,434

Hi,

for exporting to memory id use :

EXPORT &variable& TO MEMORY ID 'mem id name'.

for importing from memory id use :

IMPORT &variable& from MEMORY ID 'mem id name'.

Thanks & regards

Nayan

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Apr 10, 2008 1:34 PM

Read only

0 Likes
2,434

hi Nayan,

i tried with this but it doesnt works. the memory id could be any thing say 'mmid1' ?

Regards,

Anil.

Read only

0 Likes
2,434

Hi,

Memory is is just some random name which u assign for your variable. You can export ur variable to this memory id always and import it also. Just debug ur programme and check it once again. If its still not possible, send me ur code, il do the needful

Thanks & Regards

Nayan

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Apr 10, 2008 1:35 PM

Read only

0 Likes
2,434

hi Nayan,

program--1

data gv_ckbox(1) type c value 'y'.

EXPORT gv_ckbox TO MEMORY ID 'CKBOX'.

clear gv_ckbox.

IMPORT gv_ckbox FROM MEMORY ID 'CKBOX'.

write 😕 gv_ckbox .

program--2

data gv_ckbox(1) type c.

IMPORT gv_ckbox FROM MEMORY ID 'CKBOX'.

write 😕 gv_ckbox.

It works within the same program(program1) but not for program2.

Read only

0 Likes
2,434

Hi Anil,

Have a look at demo programs

DEMO_DATA_EXT_CLUSTER_IMPORT

DEMO_DATA_EXT_CLUSTER_EXPORT

Hope this helps

Thanks

Lakshman

Read only

0 Likes
2,434

I've just tried it and it works..

Are your programs on the same system?

Or maybe somewhere a 'FREE MEMORY' statement?

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Apr 10, 2008 1:35 PM

Read only

0 Likes
2,434

Hi,

When u open a session, execute your first programme, after this is executed, you go back in the same session and execute ur second programme. It works. I just checked it.

thanks

Nayan

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Apr 10, 2008 1:36 PM

Read only

Former Member
0 Likes
2,435

Hi anilkumar,

1. U want the value of some variable xyz

from program 1,

into program 2.

2. We can use what u said.

3. Just make sure of the following things.

4. a) the variable name should be same

(in prog1, prog2)

b) The Declaration should also match

c) use export / import with the same name as variable

In prog1:

eg. DATA : MYVAR TYPE I.

EXPORT MYVAR TO MEMORY ID 'MYVAR'

In prog2:

eg. DATA : MYVAR TYPE I.

IMPORT MYVAR FROM MEMORY ID 'MYVAR'

5. Then it will work fine.

6. Moreover, u can check the value of

sy-subrc just after export/import

to know, whether it was successful or not.

regards,

amit m.