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

problem creating a tab delimited text file

Former Member
0 Likes
1,576

Following is my peice of code. Can someone tell me what parameter should i pass in field-separator so that my file downloaded wil be a tab delimited file.

CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'

EXPORTING

i_field_seperator = 't'

TABLES

i_tab_sap_data = i_final

CHANGING

i_tab_converted_data = i_csvtab

EXCEPTIONS

conversion_failed = 1

OTHERS = 2.

IF sy-subrc NE 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

*--Download the SAP Converted file to the filepath specified.

filename = p_file.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = filename

filetype = 'ASC'

write_field_separator = ' '

TABLES

data_tab = i_csvtab

EXCEPTIONS

OTHERS = 1.

if sy-subrc = 0.

write: 'File downloaded successfuly to the location', filename, '.'.

endif.

clear: filename, i_csvtab.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,055

don't use 'SAP_CONVERT_TO_TEX_FORMAT' just use gui_download with write_field_separator = 'X'. The file will be tab delimited

Following is my peice of code. Can someone tell me what parameter should i pass in field-separator so that my file downloaded wil be a tab delimited file.

CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'

EXPORTING

i_field_seperator = 't'

TABLES

i_tab_sap_data = i_final

CHANGING

i_tab_converted_data = i_csvtab

EXCEPTIONS

conversion_failed = 1

OTHERS = 2.

IF sy-subrc NE 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

*--Download the SAP Converted file to the filepath specified.

filename = p_file.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = filename

filetype = 'ASC'

write_field_separator = ' '

TABLES

data_tab = i_csvtab

EXCEPTIONS

OTHERS = 1.

if sy-subrc = 0.

write: 'File downloaded successfuly to the location', filename, '.'.

endif.

clear: filename, i_csvtab.

3 REPLIES 3
Read only

Former Member
0 Likes
1,055

Can you tell what that function module is doing?

You are probably going to have to define a variable as type hex with a value that is equal to the hex value of the TAB (maybe like '09') and pass that through the function module (may have to move it through a character(1) type field as well.

Cheers

John

Read only

Former Member
0 Likes
1,056

don't use 'SAP_CONVERT_TO_TEX_FORMAT' just use gui_download with write_field_separator = 'X'. The file will be tab delimited

Read only

Former Member
0 Likes
1,055

Hi,

I've had the same problem, I've needed to convert a SAP table into a file but before every data and import fields should be translated in output format.

I've used SAP_CONVERT_TO_TEX_FORMAT and after GUI_DOWNLOAD and the tabulators were perfect.

the right code is attacched.