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 and import

Former Member
0 Likes
1,367

Hi All,

Please see the cide below.

DATA : lv_num1 TYPE i VALUE '10',

lv_num2 TYPE i.

DATA : id TYPE c LENGTH 10 VALUE 'TEST'.

EXPORT lv_num1 TO MEMORY ID id.

IMPORT lv_num2 FROM MEMORY ID id.

WRITE 😕 lv_num2.

why I am not getting 10 in lv_num2?

Regards,

Jeetu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,323

Hi jeetu,

The problem is, when u r exporting lv_num1 to memory id, the value will get exported but it will be identified as "lv_num1" in the memory space. so when u r trying to import with the name "lv_num2" the name is not available in memory..

try this piece of code and it will work...

data: A TYPE I,

B TYPE I.

a = 2222.

EXPORT A FROM A TO MEMORY ID 'ZAVPTEST'.

IMPORT A TO B FROM MEMORY ID 'ZAVPTEST'.

WRITE B.

Here when i am importing, i am importing the value that was stored with the name "B'. SAP has provided this option so that u can export multiple values to the same memory id and then import from there. so for importing the values to the correct variables, u need this option..

Regards,

Anoop V Panackal

Hi All,

Please see the cide below.

DATA : lv_num1 TYPE i VALUE '10',

lv_num2 TYPE i.

DATA : id TYPE c LENGTH 10 VALUE 'TEST'.

EXPORT lv_num1 TO MEMORY ID id.

IMPORT lv_num2 FROM MEMORY ID id.

WRITE 😕 lv_num2.

why I am not getting 10 in lv_num2?

Regards,

Jeetu

11 REPLIES 11
Read only

Former Member
0 Likes
1,323

hiiii

because here first you are sending value 10 to memory id ID.then by using IMPORT statement you are fetching value of memory id ID so you will get 10 value only as you are sending value of lv_num1 to memory id & its value is 10 only..

regards

twinkal

Read only

Former Member
0 Likes
1,323

hi,

Add TO DATABASE as in this statement:-

EXPORT v_time

FROM sy-uzeit

TO DATABASE indx(xy)

ID c_time.

EXPORT v_date

FROM sy-datum

TO DATABASE indx(xy)

ID c_date.

give it as indx(xy) only..

c_time, c_date i declared were constants.. the Actual Statement was:

EXPORT v_time

FROM sy-uzeit

TO DATABASE indx(xy)

ID 'IN_8081_TIME'.

Tell me if your problem is solved,, i will tell you why it was not displaying..

Read only

0 Likes
1,323

IMPORT v_time

TO v_lastruntime

FROM DATABASE indx(xy)

ID c_time.

for the Previous Export,, this is the Import..

Read only

Former Member
0 Likes
1,323

Hi Jeetu,

you are not getting any value in lv_num2 as there is no value for it in memory id, you are exporting for lv_num1 so you will get 10 for lv_num1 only. try this you can import this in some other report program.

DATA : lv_num1 TYPE i VALUE '10',
lv_num2 TYPE i.

DATA : id TYPE c.

EXPORT lv_num1 TO MEMORY ID id.

IMPORT lv_num1 FROM MEMORY ID id.

WRITE :/ lv_num2, lv_num1.

refer to the link below:

http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3bde358411d1829f0000e829fbfe/content.htm

With Luck,

Pritam.

Edited by: Pritam Ghosh on Jul 11, 2008 9:00 AM

Read only

Former Member
0 Likes
1,324

Hi jeetu,

The problem is, when u r exporting lv_num1 to memory id, the value will get exported but it will be identified as "lv_num1" in the memory space. so when u r trying to import with the name "lv_num2" the name is not available in memory..

try this piece of code and it will work...

data: A TYPE I,

B TYPE I.

a = 2222.

EXPORT A FROM A TO MEMORY ID 'ZAVPTEST'.

IMPORT A TO B FROM MEMORY ID 'ZAVPTEST'.

WRITE B.

Here when i am importing, i am importing the value that was stored with the name "B'. SAP has provided this option so that u can export multiple values to the same memory id and then import from there. so for importing the values to the correct variables, u need this option..

Regards,

Anoop V Panackal

Read only

Former Member
0 Likes
1,323

Hi Jeetu,

What I observed is you are exporting lv_num1 to memory id 'ID' and importing the value of lv_num2 from memory id 'ID'. So just change the code as below.

EXPORT lv_num1 TO MEMORY ID id.

IMPORT lv_num1 FROM MEMORY ID id.

WRITE 😕 lv_num1.

If you want the value to be in lv_num2 also just write as :

lv_num2 = lv_num1. after you import the value.

Regards,

Swapna.

Read only

Former Member
0 Likes
1,323

Hi,

Write this,

EXPORT lv_num1 TO MEMORY ID id.

IMPORT lv_num1 to lv_num2 FROM MEMORY ID id.

Write:

lv_num2.

Regards,

Sujit

Read only

0 Likes
1,323

Hi,

have a look.

you mention in your code.

MEMORY ID id.

but you have to mention like

MEMORY ID 'ID'.

try like this.

regards.

sriram.

Read only

Former Member
0 Likes
1,323

DATA : lv_num1 TYPE i VALUE '10',

lv_num2 TYPE i.

DATA : id TYPE c LENGTH 10 VALUE 'TEST'.

EXPORT lv_num1 TO MEMORY ID id.

IMPORT lv_num1 FROM MEMORY ID id.

WRITE 😕 lv_num2.

You should use the same name and type when you are using import.

Read only

Former Member
0 Likes
1,323

Hi jeetu,

DATA : lv_num1 TYPE i VALUE 10,

lv_num2 TYPE i LENGTH 10 VALUE 'TEST'.

.

DATA : id TYPE c .

EXPORT lv_num1 to MEMORY ID id.

IMPORT lv_num1 to lv_num2 from MEMORY ID id.

WRITE: lv_num2.

Regards,

Sravanthi

Read only

Former Member
0 Likes
1,323

Hi

In your code you use

MEMORY ID id.

But try with

MEMORY ID 'ID'

.

Hope it will solve your problem

Thanks & Regards

Nikunj shah