Skip to Content
author's profile photo Former Member
Former Member

EXPORT - IMPORT from SAP Memory

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Jan 08, 2008 at 08:48 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2008 at 08:46 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2008 at 09:00 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.