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 - IMPORT from SAP Memory

Former Member
0 Kudos

hi,

I have to code in two methods belonging to the same class. An internal table is to be passed from one method to the other.

I am using EXPORT - IMPORT . But it is not working. Can you tellme, where i am going wrong?

Method 1:

CONCATENATE 'memory1' sy-datum INTO v_memoryloc1.

CONCATENATE 'memory2' sy-datum INTO v_memoryloc2.

delete from MEMORY ID v_memoryloc1.

delete from MEMORY ID v_memoryloc2.

EXPORT v_mem FROM v_exitflag TO MEMORY ID v_memoryloc1.

EXPORT v_memory FROM it_output TO MEMORY ID v_memoryloc2.

Method 2:

CONCATENATE 'memory1' sy-datum INTO v_memoryloc1.

CONCATENATE 'memory2' sy-datum INTO v_memoryloc2.

IMPORT v_mem TO v_exitflag FROM MEMORY ID v_memoryloc1.

IMPORT v_memory TO it_output FROM MEMORY ID

v_memoryloc2.

DELETE FROM MEMORY ID v_memoryloc1.

DELETE FROM MEMORY ID v_memoryloc2.

1 ACCEPTED SOLUTION

former_member200338
Active Contributor
0 Kudos

Hi,

The memory id are valid until it executes the code. if you want to fetch the details from memory even after the program executes, then use export to database memory instead of memory id.

like this,

Data: ls_indx TYPE indx.

ls_indx-aedat = sy-datum.

ls_indx-usera = sy-uname.

ls_indx-pgmid = sy-repid.

EXPORT tab = lt_vbkd

TO DATABASE indx(V1)

FROM ls_indx ID 'ZTEST'.

IMPORT tab = lt_vbkd

FROM DATABASE indx(V1)

TO ls_indx ID 'ZTEST'.

Reward points if useful.

Regards,

Niyaz

5 REPLIES 5

Former Member
0 Kudos

Hi Balaji,

Make sure you are using both Methods in same program.. (or it's in called program / FM)..

For transporting internal table try using ITAB[] instead of ITAB...This can lead to exporting only headerline to Memory..

Regards,

Mohaiyuddin

0 Kudos

I am also exporting a variable v_exitflag. Even i am not getting that correct.

Actually during debugging, sy-subrc is 4 for these steps.

former_member200338
Active Contributor
0 Kudos

Hi,

The memory id are valid until it executes the code. if you want to fetch the details from memory even after the program executes, then use export to database memory instead of memory id.

like this,

Data: ls_indx TYPE indx.

ls_indx-aedat = sy-datum.

ls_indx-usera = sy-uname.

ls_indx-pgmid = sy-repid.

EXPORT tab = lt_vbkd

TO DATABASE indx(V1)

FROM ls_indx ID 'ZTEST'.

IMPORT tab = lt_vbkd

FROM DATABASE indx(V1)

TO ls_indx ID 'ZTEST'.

Reward points if useful.

Regards,

Niyaz

0 Kudos

thx a lot dude...

it worked out.......

10 points 2 ya

Former Member
0 Kudos

If sy-subrc = 4 ==> this means you are executing 2 methods in different programs, hence Import is not able to find Memory ID set by Method1.

Regards,

Mohaiyuddin