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

IMPORT and EXPORT 2 internal table to memory?

Former Member
0 Likes
7,330

Hi all,

Can you please tell me that is it possible to import and export 2 interal table to memroy?

If yes

I tried to export and import for 2nd table same way as i did for first table but its not comming for 2nd table.

Thanks in advance.

Hi all,

Can you please tell me that is it possible to import and export 2 interal table to memroy?

If yes

I tried to export and import for 2nd table same way as i did for first table but its not comming for 2nd table.

Thanks in advance.

9 REPLIES 9
Read only

Former Member
0 Likes
6,173
EXPORT ITAB  TO MEMORY ID 'table'.

IMPORT ITAB FROM MEMORY ID 'TABLE'.

[IMPORT/EXPORT|http://help.sap.com/saphelp_nw04/Helpdata/EN/fc/eb3bde358411d1829f0000e829fbfe/content.htm]

Both the import and export structure should be same.

Regards,

Gurpreet

Read only

Former Member
0 Likes
6,173

You can IMPORT and EXPORT an internal table by sending it to MEMORY ID as:

In a report, you can export the data of internal table to memory id 'table'.

EXPORT t_table TO MEMORY ID 'table'.

And then you can import the same data again as:

IMPORT t_table FROM MEMORY ID 'table'.

Read only

0 Likes
6,173

I want to import and export 2 internal table is it possible?

Read only

0 Likes
6,173

Try:

EXPORT t_table TO MEMORY ID 'table'.

EXPORT t_table1 TO MEMORY ID 'table1'.

IMPORT t_table FROM MEMORY ID 'table'.

IMPORT t_table1 FROM MEMORY ID 'table1'.

Read only

Former Member
0 Likes
6,173

If you want to export and import 2 itabs... you can do it using two different memory ids... like 'table1' and 'table2'....

Read only

Former Member
0 Likes
6,173

Hi dude,

we can do that ...

Create 2 reports...

Copy paste the below codes and execute.. Report Teset2.

REPORT TEST2.

DATA: ITAB TYPE I OCCURS 10,

ITAB2 TYPE I OCCURS 10,

NUM TYPE I.

SUBMIT TEST1 AND RETURN.

IMPORT ITAB FROM MEMORY ID 'HK'.

LOOP AT ITAB INTO NUM.

WRITE / NUM.

ENDLOOP.

skip 5.

IMPORT ITAB2 FROM MEMORY ID 'MK'.

LOOP AT ITAB2 INTO NUM.

WRITE / NUM.

ENDLOOP.

-


REPORT TEST1.

DATA: NUMBER TYPE I,

ITAB TYPE I OCCURS 10.

DATA: NUMBER2 TYPE I,

ITAB2 TYPE I OCCURS 10.

DO 5 TIMES.

NUMBER = SY-INDEX.

APPEND NUMBER TO ITAB.

ENDDO.

DO 15 TIMES.

NUMBER2 = SY-INDEX.

APPEND NUMBER2 TO ITAB2.

ENDDO.

EXPORT ITAB TO MEMORY ID 'HK'.

EXPORT ITAB2 TO MEMORY ID 'MK'.

Read only

MarcinPciak
Active Contributor
0 Likes
6,173

Do it in one shot:


EXPORT mem_tab1 FROM tab1[] 
              mem_tab2 FROM tab2[] TO MEMORY ID 'MY_TABS'.   

IMPORT mem_tab1 TO tab1[] 
             mem_tab2 TO tab2[] FROM MEMORY ID 'MY_TABS'.    

It saves both your table content under mem_tab1 and mem_tab2 in memory id 'MY_TABS' and then reads back from that place.

Regards

Marcin

Sorry some corrections.

Edited by: Marcin Pciak on Mar 20, 2009 6:55 PM

Read only

Former Member
0 Likes
6,173

use like this


IMPORT l_it_ztable = l_it_ztable FROM MEMORY ID 'ZTABLE'. "memory id can be any string id

EXPORT l_it_ztable = l_it_ztable TO MEMORY ID 'ZTABLE'. "same as above

Read only

Former Member
0 Likes
6,173

HI

you can use

IMPORT T_ITAB FROM MEMORY ID 'ABC'.
EXPORT T_ITAB TO MEMORY ID 'ABC'.

But this will give you an EPC error in new versions .

So try this also.

EXPORT T_ITAB FROM T_ITAB TO MEMORY ID 'ABC'.
IMPORT T_ITAB TO T_ITAB FROM MEMORY ID 'ABC.'

Regards

Hareesh Menon