Skip to Content

CSV file - Strings with multiple double quotes and commas

Dear Guru's,

I am trying to write data from an internal table into a CSV file, but some fields has multiple commas (,) and double quotes (") within it. I tried covering the whole string within double quotes ("), but since the string has multiple double quotes and commas, the output in the file is not aligned. Can someone guide me how to overcome this issue ?

I don't want to have Horizontal tab as delimiter, since this is .CVS file and not .XLS file.

Thanks and Regards,

Gaurav.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Feb 10, 2016 at 09:25 PM

    Got the issue resolved.

    Followed the format of adding double quotes before existing ones and also covering the entire string within double quotes, as mentioned in the below RFC.

    RFC 4180 - Common Format and MIME Type for Comma-Separated Values (CSV) Files

    Best Regards,

    Gaurav.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 10, 2016 at 08:45 PM

    I suggest you generate it with ;

    (Semicolon).

    Additionalally you can use the following function module.

    SAP_CONVERT_TO_CSV_FORMAT


    Regards, Andreas

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.