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

Convert Internal table into CSV Format and upload into Application server

Former Member
7,410

Hi Experts,

I have a requirement where i need to convert the data from internal table into csv format with tab delimiter and save it in application server. The issue is i cannot use comma as the decimal format used is comma.when i use comma as the delimiter and download the file in .csv format using tcode CG3Y,it is working fine but the quantity field is impacted due to decimal notation. I have tried using FM SAP_CONVERT_TO_CSV_FORMAT but it is not helping.

Can you please help me with a solution where the data is converted into csv format and when downloaded from application server through CG3Y in csv format each data should be displayed in each column.

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

former_member226519
Active Contributor
5,613

did you try to enclose numbers with apostrophe?

7 REPLIES 7
Read only

matt
Active Contributor
5,613

Use tab delimited instead? Or semi-colon delimited?

Read only

Former Member
0 Likes
5,613

Hi,

Tab delimeter(cl_abap_char_utilities=>horizontal_tab) works fine for xls but not for csv or xlsx. Semi-colon is not helping either.

Thanks and Regards,

Read only

matt
Active Contributor
0 Likes
5,613

In what way is it not working? Tab delimited is a valid XLSX format - reading and writing.

Read only

Former Member
0 Likes
5,613

Hi,

With tab delimiter while opening the file i am getting "Excel cannot open the file because the file format or file extension is not valid".

Thanks and Regards

Read only

Nawanandana
Active Contributor
0 Likes
5,613

Hi,

you can use i_field_seperator = ';' or '|' any seperate what you need.

CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = itab
CHANGING
i_tab_converted_data = itab1
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

0 Likes
5,613

Hi,

I have tried this but neither its working with ;' nor '|'.

Thanks and Regards.

Read only

former_member226519
Active Contributor
5,614

did you try to enclose numbers with apostrophe?