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: 

Creating tab delimited file

Former Member
0 Kudos

Hi,

Can anybody tell me how to create tab delimited file using ABAP. I am using 4.6C ( so I cant use cl_gui_char_utilities ) and I want to download the file to application server ( GUI_DOWNLOAD cant be used ).

Thanks,

Sameej

5 REPLIES 5

ssimsekler
Active Contributor
0 Kudos

Hi Sameej

Look at SAPHelp about <b>"OPEN DATASET"</b> and <b>"CLOSE DATASET"</b> statements for downloading files to the application server. To download to presentation layer you can use <b>"WS_DOWNLOAD"</b> at 4.6C.

The FM <b>"C13Z_FILE_UPLOAD_BINARY"</b> and <b>"C13Z_FILE_DOWNLOAD_BINARY"</b> can also be used if you have them.

*--Serdar

0 Kudos

What I am looking forward is to separate the fields by TAB-DELIMITER.

andreas_mann3
Active Contributor
0 Kudos

Hi,

-> here's an example to separate the fields by tab:

DATA: BEGIN OF tabulator,

x(1) TYPE x VALUE '09',

END OF tabulator.

data tabilator_c.

...

CALL FUNCTION 'SYSTEM_CODEPAGE'

IMPORTING

codepage = c_to.

tabulator_c = tabulator.

TRANSLATE tabulator_c FROM CODE PAGE c_from TO CODE PAGE c_to.

...

*for int. table

loop at itab.

...

clear string.

do.

assign component sy-index of structure itab to <f>.

IF SY-SUBRC <> 0.

EXIT.

ENDIF.

concatenate string <f> tabulator_c into string.

enddo.

append string to tab_download.

...

endloop.

...

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILETYPE = 'ASC'

FILENAME = FILE

TABLES

DATA_TAB = tab_download.

Grx Andreas

nablan_umar
Active Contributor
0 Kudos

Hi Sameet,

I think Andreas has given you some good info. In short basically you need to do this.

data: lv_tabfield(1) type x value '09',

lv_str(80).

....

open dataset lv_filename for output in text mode.

concatenate field1 field2 field2 into lv_str separated by

lv_tabfield.

transfer lv_str to lv_filename.

close dataset lv_filename.

0 Kudos

Thanks Andrea, Nablan.