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

issue while downloading file in .CSV format

Former Member
0 Likes
1,664

Hi,

I need to download the file in .CSV format.

I hade used FM SAP_CONVERT_TO_CSV_FORMAT and then used GUI_Download.

Now when I am opening file which is downloaded, it gives all the data in a single column. If there are 5 fields in my table, the generated file gives the data of all the 5 fields in a single column.

Could you please help?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,445

Hi,

In GUI_DOWNLOAD function module, along with other parameters put WRITE_FIELD_SEPARATOR = 'X'.

Hope it helps

Hi,

I need to download the file in .CSV format.

I hade used FM SAP_CONVERT_TO_CSV_FORMAT and then used GUI_Download.

Now when I am opening file which is downloaded, it gives all the data in a single column. If there are 5 fields in my table, the generated file gives the data of all the 5 fields in a single column.

Could you please help?

9 REPLIES 9
Read only

Former Member
0 Likes
1,445

Hi,

After you ahve open it save ti again as a CSV format and then try to open it basically when you create a CSV file all the fields values would be in one row separated by comma try saving as CSv format and then check.

Regards,

Himanshu

Read only

Former Member
0 Likes
1,446

Hi,

In GUI_DOWNLOAD function module, along with other parameters put WRITE_FIELD_SEPARATOR = 'X'.

Hope it helps

Read only

0 Likes
1,445

Hi,

I ried using FIELD_SEPARATOR = 'X', but still the same.

Read only

0 Likes
1,445

Hi,

Check if you are using ';' as the field seperator in the FM SAP_CONVERT_TO_CSV_FORMAT.

If you want the Tab delimited file then call GUI_DOWNLOAD with FILETYPE as 'DAT' and WRITE_FIELD_SEPARATOR as 'X'.

Regards,

Vik

Read only

0 Likes
1,445

Hi,

use this it will help...

data: i_tab_converted_data TYPE truxs_t_text_data.

CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'
 EXPORTING
   i_field_seperator          = ','
*   I_LINE_HEADER              =
*   I_FILENAME                 =
*   I_APPL_KEEP                = ' '
  TABLES
    i_tab_sap_data             = <ur internal table>
 CHANGING
   i_tab_converted_data       = i_tab_converted_data
 EXCEPTIONS
   conversion_failed          = 1
   OTHERS                     = 2
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Read only

Former Member
0 Likes
1,445

hii harneet,

This has been already discussed on the forum.go through this link.u will find it very useful

rgrds,

Shweta

Read only

0 Likes
1,445

Hi Shweta,

Thanks for your help.

I was having the issue while downloading. the link u have given here is for uploading .CSV file.

Read only

0 Likes
1,445

Hi try wi th the following code.

TYPE-POOLS : truxs.

DATA: t_file TYPE STANDARD TABLE OF type_file.

data:t_conv_data TYPE truxs_t_text_data.

CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'

EXPORTING

i_field_seperator = ', '

TABLES

i_tab_sap_data = t_file

CHANGING

i_tab_converted_data = t_conv_data

EXCEPTIONS

conversion_failed = 1

OTHERS = 2.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'C:\TESTCSV.CSV'

filetype = 'ASC'

write_field_separator = ' '

TABLES

data_tab = t_file

  • fieldnames = names

EXCEPTIONS

file_write_error = 1

no_batch = 2

gui_refuse_filetransfer = 3

invalid_type = 4

no_authority = 5

unknown_error = 6

header_not_allowed = 7

separator_not_allowed = 8

filesize_not_allowed = 9

header_too_long = 10

dp_error_create = 11

dp_error_send = 12

dp_error_write = 13

unknown_dp_error = 14

access_denied = 15

dp_out_of_memory = 16

disk_full = 17

dp_timeout = 18

file_not_found = 19

dataprovider_exception = 20

control_flush_error = 21

OTHERS = 22.

Read only

Former Member
0 Likes
1,445

Hi please try with the following code.

TYPE-POOLS : truxs.

DATA: t_file TYPE STANDARD TABLE OF type_file.

data:t_conv_data TYPE truxs_t_text_data.

CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'

EXPORTING

i_field_seperator = ','

TABLES

i_tab_sap_data = t_file

CHANGING

i_tab_converted_data = t_conv_data

EXCEPTIONS

conversion_failed = 1

OTHERS = 2.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'C:\TESTCSV.CSV'

filetype = 'ASC'

write_field_separator = ' '

TABLES

data_tab = t_conv_data

  • fieldnames = names

EXCEPTIONS