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

Is import & export working in ECC version?

Former Member
0 Likes
658

i had one program. In which Export and Import is not working

properly in ECC 6.0 version where as 4.6C working fine.

If i commented the Import & Export than only it is working fine. Is there any other procedure OR how to use

import and export in ECC version. Please advise me it is very

urgent.

Edited by: jagan ravula on Jan 29, 2008 8:00 AM

4 REPLIES 4
Read only

Former Member
0 Likes
571

Hi,

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).

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.

go through these links

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

Reward Points if found helpfull..

Cheers,

Chandra Sekhar.

Read only

former_member404244
Active Contributor
0 Likes
571

Hi,

they should work..try to debug the program in both versions sametime and see what is happening..

Regards,

nagaraj

Read only

amit_khare
Active Contributor
0 Likes
571

Hi,

Import & Export do wrok in ECC, just there is a chnage in the syntax.But they do accept the old syntax only, the Extended Check will show Obselete Syntax warning.

Press F1 on the Keyword to get the syntax.

e.g.

instead of using IMPORT F1 F2 TAB3 FROM DATABASE INDX(ST) ID INDXKEY.

Use IMPORT F1 to var1 F2 to var2 TAB3 to tab1 FROM DATABASE INDX(ST) ID INDXKEY.

Regards,

Amit

Reward all helpful replies.

Read only

0 Likes
571

Hi Amit,

I am getting the same Obselete syntax error for the IMPORT statement in ECC6.0

I have chnaged the statement as you said

IMPORT F1 to var1 F2 to var2 TAB3 to tab1 FROM DATABASE INDX(ST) ID INDXKEY.

but I am not getting the data in to internal table.

Please correct me.

Thanks,

Saya