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

Open Data set csv upload error encoding

0 Likes
436

Hi Experts,

I generate a CSV file like this:

SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } .L0S31 { font-style: italic; color: #808080; } .L0S32 { color: #3399FF; } .L0S33 { color: #4DA619; } .L0S52 { color: #0000FF; } .L0S55 { color: #800080; } .L0S70 { color: #808080; }

CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = cl_abap_char_utilities=>horizontal_tab
I_LINE_HEADER = 'X'
i_filename = ld_name
* I_APPL_KEEP = ' '
TABLES
i_tab_sap_data = lt_list
CHANGING
i_tab_converted_data = lt_converted
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

And then I transfer the data to server like this:

SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } .L0S31 { font-style: italic; color: #808080; } .L0S32 { color: #3399FF; } .L0S52 { color: #0000FF; } .L0S55 { color: #800080; } .L0S70 { color: #808080; }

"Pasamos la tabla con los datos en binario al servidor
OPEN DATASET ld_filename FOR OUTPUT IN TEXT MODE ENCODING UTF-8. "IN TEXT MODE ENCODING UTF-8."FOR OUTPUT IN BINARY MODE.
LOOP AT lt_converted INTO DATA(ls_converted).
TRY.
TRANSFER ls_converted TO ld_filename.
CATCH cx_sy_file_open_mode INTO lo_sy_file_open_mode.

I try it also with: IN TEXT MODE ENCODING DEFAULT AND ENCODING NON-UNICODE. but nothing works when I download the csv from the server some characters, accents for example, are substitute by strange simbols. If I reconvert mi csv file to a .txt and I open it in Excel with the assistant I can change the encoding manually and then the simbols are correct, but I need a solution when I open my CSV directly using EXCEL the simbols appear correctly without using asistants and reconverting files.

Thanks so much!

0 REPLIES 0