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 an internal table to memory and import from memory into an internal

Former Member
0 Kudos

I am trying to export an internal table to memory and import from memory into an internal table. It looks like the export works, but when I import in program2, the internal table is empty. Even when the command returns sy-subrc = 0.

Has anyone made this work?

<u><b>Program1</b></u>

DATA: BEGIN OF wa_invalid,

z_err.

INCLUDE STRUCTURE hbsid.

DATA: END OF wa_invalid,

DATA: invalid LIKE TABLE OF wa_invalid WITH HEADER LINE.

EXPORT invalid TO MEMORY ID 'errors'.

SUBMIT program2.

<u><b>Program2</b></u>

DATA: BEGIN OF wa_invalid,

z_err.

INCLUDE STRUCTURE hbsid.

DATA: END OF wa_invalid,

t_invalid_assignment LIKE TABLE OF wa_invalid_assignment

WITH HEADER LINE.

REFRESH: t_invalid.

IMPORT: invalid to t_invalid FROM MEMORY ID 'errors'.

1 ACCEPTED SOLUTION

ferry_lianto
Active Contributor
0 Kudos

Hi Rod,

Welcome to SDN.

Please check this sample code.

types : begin of t_itab,

name(10),

end of t_itab.

data: itab type table of t_itab with header line.

ws_memid = 'MY_MEMID'.

export itab to memory id ws_memid.

In second program,

types : begin of t_itab,

name(10),

end of t_itab.

data: itab type table of t_itab with header line.

ws_memid = 'MY_MEMID'.

import itab from memory id ws_memid.

Regards,

Ferry Lianto

5 REPLIES 5

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Where is the internal table declaration for t_INVALID in program two. Make sure that it is exactly the same as in program 1.

Also try to use the syntax like this.



EXPORT invalid = invalid TO MEMORY ID 'ERRORS'.

IMPORT invalid = t_invalid FROM MEMORY ID 'ERRORS'.

Really, it is a good idea to the name of your internal table the same across both programs. So if you were to rename the one in the first program, it should work then.



EXPORT invalid = t_invalid TO MEMORY ID 'ERRORS'.

IMPORT invalid = t_invalid FROM MEMORY ID 'ERRORS'.

Regards,

Rich Heilman

ferry_lianto
Active Contributor
0 Kudos

Hi Rod,

Welcome to SDN.

Please check this sample code.

types : begin of t_itab,

name(10),

end of t_itab.

data: itab type table of t_itab with header line.

ws_memid = 'MY_MEMID'.

export itab to memory id ws_memid.

In second program,

types : begin of t_itab,

name(10),

end of t_itab.

data: itab type table of t_itab with header line.

ws_memid = 'MY_MEMID'.

import itab from memory id ws_memid.

Regards,

Ferry Lianto

0 Kudos

This is just like my code.

0 Kudos

What is? I would suggest making the internal tables names the same in both programs and using the syntax describe in my eariler post. I do this kind of thing all the time, and it works great.

Regards,

Rich Heilman

0 Kudos

<b>You were right!</b> I renamed the itabs and all is well. Sorry for my frustration and thank you for your assistance.