‎2008 Apr 10 2:41 PM
hi,
how to export a variable to memory and import the same?
Regards,
Anil.
‎2008 Apr 10 3:49 PM
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.
‎2008 Apr 10 2:45 PM
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
‎2008 Apr 10 2:47 PM
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
‎2008 Apr 10 3:05 PM
hi Nayan,
i tried with this but it doesnt works. the memory id could be any thing say 'mmid1' ?
Regards,
Anil.
‎2008 Apr 10 3:08 PM
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
‎2008 Apr 10 3:24 PM
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.
‎2008 Apr 10 3:34 PM
Hi Anil,
Have a look at demo programs
DEMO_DATA_EXT_CLUSTER_IMPORT
DEMO_DATA_EXT_CLUSTER_EXPORT
Hope this helps
Thanks
Lakshman
‎2008 Apr 10 3:39 PM
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
‎2008 Apr 10 3:45 PM
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
‎2008 Apr 10 3:49 PM
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.