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

EXPORT/IMPORT Internal table..

Former Member
0 Likes
1,505

Hi all,

I have problem to export import the whole internal table,

can any one help how to export/import internal tables..

any sample code pls?

thx

6 REPLIES 6
Read only

Former Member
0 Likes
692

hi rag,

do u want to import/export from where?

To import from txt, look this:

REPORT ZTXTTOTABLE .

DATA: p_file TYPE string value 'C:\teste.txt',

BEGIN OF TI_table OCCURS 0,

COD(5) TYPE C,

NAME(40),

END OF TI_table,

a(2).

PARAMETERS: sel_file(128) TYPE c

default 'C:\teste.txt' OBLIGATORY LOWER CASE.

p_file = sel_file.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = p_file

TABLES

data_tab = ti_table[].

format color COL_TOTAL INTENSIFIED ON.

loop at ti_table.

write: / sy-vline, ti_table-cod, at 10 sy-vline, ti_table-name,

at 60 sy-vline.

endloop.

write: / sy-uline(60).

AT SELECTION-SCREEN ON VALUE-REQUEST FOR sel_file.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

def_filename = ''

def_path = 'C:\'

mask = ',Documentos de texto (*.txt), *.txt.'

mode = ''

IMPORTING

filename = p_file

EXCEPTIONS

inv_winsys = 1

no_batch = 2

selection_cancel = 3

selection_error = 4

OTHERS = 5.

find '.txt' IN p_file.

if sy-subrc <> 0.

concatenate p_file '.txt' into sel_file.

else.

sel_file = p_file.

endif.

top-of-page.

format color COL_HEADING INTENSIFIED ON.

uline (60).

write: / sy-vline, 'COD', at 10 sy-vline, 'NAME', at 60 sy-vline.

write: / sy-uline(60).

Regards

Allan Cristian

Read only

Former Member
0 Likes
692

hi rag,

to export to txt try it:

&----


*& Report ZTABLETOTXT *

*& *

&----


*& *

*& *

&----


REPORT ZTABLETOTXT .

TABLES: spfli.

DATA: ti_spfli LIKE STANDARD TABLE OF spfli WITH HEADER LINE,

p_file TYPE string value 'C:\spfli.txt'.

PARAMETERS: sel_file(128) TYPE c

default 'C:\spfli.txt' OBLIGATORY LOWER CASE.

SELECT * FROM spfli INTO TABLE ti_spfli.

p_file = sel_file.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = p_file

TABLES

DATA_TAB = ti_spfli[].

IF SY-SUBRC = 0.

MESSAGE I398(00) WITH 'Arquivo criado com sucesso!'.

else.

MESSAGE E398(00) WITH 'Ocorreu um erro!'.

ENDIF.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR sel_file.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

def_filename = ''

def_path = 'C:\'

mask = ',Documentos de texto (*.txt), *.txt.'

mode = ''

IMPORTING

filename = p_file

EXCEPTIONS

inv_winsys = 1

no_batch = 2

selection_cancel = 3

selection_error = 4

OTHERS = 5.

find '.txt' IN p_file.

if sy-subrc <> 0.

concatenate p_file '.txt' into sel_file.

else.

sel_file = p_file.

endif.

Regards

Allan Cristian

Read only

Former Member
0 Likes
692

Hi,

go through these links

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/export01.htm

Reward points if it helps,

Satish

Read only

Former Member
0 Likes
692

DATA BEGIN OF lt1_int_edidd OCCURS 0.

INCLUDE STRUCTURE edidd.

DATA END OF lt1_int_edidd.

After you fetch data to this internal table you can export to the memory when you leave from this progrmm to a different program.

EXPORT lt1_int_edidd TO MEMORY ID 'ZINT_EDIDD'.

When you return back you can inport the data from memory to the internal table.

IMPORT lt1_int_edidd FROM MEMORY ID 'ZINT_EDIDD'.

Make sure you free the imemory ID after you import it.

FREE MEMORY ID 'ZINT_EDIDD'.

Hopr this is what you were looking for.

Shreekant

Read only

0 Likes
692

Hi,

Your right what mean but i am aunable to import data to internal tablefrom memory ID..

My problem: I have to export the intertable to memory in Some user exit of the Transaction and then import the same internal table from Memory id in other user exit for the same transaction.. thats means that it is internal session only right..

Waht i am facing now;

I am exporting the internal table to memoty id and i have to import the same internal table data some where in User exit in the same transaction, but i didnt get even single record from there.. Is there any other way to do this.. pls its urgent..

I used like below, just example..

data: itab like mara occurs o with header line.

do some data mani plication and store the records in Itab

and Export to memeory like below..

Export itab to memory id 'YFI_ITB'.

Then i am traying to imprt it from other userexit.. like below..

Import itab from memory id 'YFI_ITB'.

But its not giving the records..

Thx

thx

Read only

0 Likes
692

You have to keep the same strcutres for both ITAB, while exporting and while imorting.

Regards,

Naimesh Patel