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: 

Download to txt

Former Member
0 Kudos

Hi,

I broke the sdata into fields of an internal table and now i want to pass this table to a txt file.But when i pass i think he eliminates the blank spaces and when i look to the file it´s all messed up.what i want is the file to look like like a table with the headers on the top and the fields corresponding to the header allign underneath.

Thanks,

Ricardo

5 REPLIES 5

Former Member
0 Kudos

I don't think it will be possible with TXT file, you probably can try with XLS file.

Regards,

Ravi

Former Member
0 Kudos

Hi ricardo,

1. use like this

just copy paste in new program.

2. the field names will not come.

report abc.

*----


data : t001 like table of t001 with header line.

*----


select * from t001 into table t001.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = 'd:\t001.txt'

WRITE_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = t001.

regards,

amit m.

Former Member
0 Kudos

HI,

CALL FM GUI_DOWNLOAD

SPECIFY FILETYPE AS 'ASC'

AND SET WRITE_FIELD_SEPARATOR = 'X'.

HOPE THIS HELPS,

PRIYA.

former_member188685
Active Contributor
0 Kudos

Hi,

as suggested above using WRITE_FIELD_SEPARATOR = 'X' option of GUI_DOWNLOAD you can achieve that.

try it.

Regards

vijay

Former Member
0 Kudos

Hi,

A Sample program.

DATA: BEGIN OF ITAB OCCURS 0,

F1(4) TYPE C,

F2(4) TYPE C,

F3(3) TYPE C,

END OF ITAB.

START-OF-SELECTION.

ITAB-F1 = 'ABCD'. ITAB-F2 = 'EFGH'. ITAB-F3 = 'IJK'.

APPEND ITAB. CLEAR ITAB.

ITAB-F1 = 'ABCD'. ITAB-F2 = ''. ITAB-F3 = 'IJK'.

APPEND ITAB. CLEAR ITAB.

ITAB-F1 = 'ABCD'. ITAB-F2 = 'EFGH'. ITAB-F3 = 'IJK'.

APPEND ITAB. CLEAR ITAB.

ITAB-F1 = 'ABCD'. ITAB-F2 = 'EFGH'. ITAB-F3 = 'IJK'.

APPEND ITAB. CLEAR ITAB.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'C:\481.TXT'

WRITE_FIELD_SEPARATOR = 'X'

tables

data_tab = ITAB.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Regards,

Sailaja.