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 comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    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 comment
    10|10000 characters needed characters exceeded

  • 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 comment
    10|10000 characters needed characters exceeded