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 export internal table

Former Member
2,835

Hi.

How can i make an import export of an internal table but with the sap memory.

Thanks.

Regards

Miguel

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,446

If the number of entries in table is less following logic could be used..

Suppose wa_tab is the work area and lit_tab is the table that you need to import and export into lit_new.

DATA : lv_count_char TYPE CHAR3,

lv_field TYPE char6.

DESCRIBE TBALE lit_tab LINES lv_lines.

SET PARAMETER ID 'LINES' FIELD lv_lines.

---> Setting the value

LOOP at lit_tab INTo wa_tab.

MOVE sy-tabix TO lv_count_char.

CONCATENATE 'FLD' lv_count_char INTO lv_field.

SET PARAMETER ID lv_field FIELD wa_tab.

ENDLOOP.

---> Rerieving the value

GET PARAMETER ID 'LINES' FIELD lv_lines.

DO.

lv_count = lv_count + 1.

MOVE lv_count TO lv_count_char.

CONCATENATE 'FLD' lv_count_char INTO lv_field.

GET PARAMETER ID lv_field FIELD wa_tab.

APPEND wa_tab TO lit_new.

IF lv_count GE lv_lines.

EXIT.

ENDIF.

ENDDO.

8 REPLIES 8
Read only

Former Member
0 Likes
1,446

Hi,

The SET PARAMETER and GET PARAMETER statements allow you to write to, or read from, the SAP memory.

ITAB it_matnr should be of same type and structure in both programs.

SET PARAMETER ID 'MAT' field it_matnr.
GET PARAMETER ID 'MAT' field it_matnr.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,446

Hello All,

As of current ABAP release you cannot transfer an internal table(deep structure) using SET/GET PARAMETER.

@OP: Is there any reason you want to transfer the internal table to SAP memory?

BR,

Suhas

Read only

Former Member
0 Likes
1,447

If the number of entries in table is less following logic could be used..

Suppose wa_tab is the work area and lit_tab is the table that you need to import and export into lit_new.

DATA : lv_count_char TYPE CHAR3,

lv_field TYPE char6.

DESCRIBE TBALE lit_tab LINES lv_lines.

SET PARAMETER ID 'LINES' FIELD lv_lines.

---> Setting the value

LOOP at lit_tab INTo wa_tab.

MOVE sy-tabix TO lv_count_char.

CONCATENATE 'FLD' lv_count_char INTO lv_field.

SET PARAMETER ID lv_field FIELD wa_tab.

ENDLOOP.

---> Rerieving the value

GET PARAMETER ID 'LINES' FIELD lv_lines.

DO.

lv_count = lv_count + 1.

MOVE lv_count TO lv_count_char.

CONCATENATE 'FLD' lv_count_char INTO lv_field.

GET PARAMETER ID lv_field FIELD wa_tab.

APPEND wa_tab TO lit_new.

IF lv_count GE lv_lines.

EXIT.

ENDIF.

ENDDO.

Read only

Former Member
0 Likes
1,446

Hi.

In the morning there is a process that i dont need all the items in the internal table, and then in the night they want to restore all the items, so i need to make a copy of the internal table.

Read only

0 Likes
1,446

Hi,

please use *EXPORT ... TO DATABASE ... * for that. You can use database table iNDX or create your own customer database tabel for that. This customer table needs the same defintion as INDX in SE11.

Regards,

Klaus

Read only

Former Member
0 Likes
1,446

Hi,

To export internal table to memory from a program, please use following piece of code:

EXPORT itab TO MEMORY ID 'ABCD'.

To import the same internal table back to another program, please use the following piece of code:

IMPORT itab FROM MEMORY ID 'ABCD'.

Also note that itab should be similarly defined and named in both the programs.

Kindly let me know in case of any issues.

Regards,

Shayeree

Edited by: shayeree on Oct 10, 2011 10:52 AM

Read only

Former Member
0 Likes
1,446

Hi,

try this:


DATA: IT_MARA TYPE TABLE OF MARA.
*
SELECT * FROM MARA INTO TABLE IT_MARA UP TO 10 ROWS.
EXPORT IT_MARA  FROM IT_MARA TO MEMORY ID 'ZZ_MARA'.
CLEAR IT_MARA[].
IMPORT IT_MARA  FROM MEMORY ID 'ZZ_MARA'.

Regards, Dieter

Read only

Former Member
0 Likes
1,446

HI

U can use export and import .

Like this

Export IT_table memory id ABC

Then u can import where you want

Import IT_TABLE from memory id ABC