cancel
Showing results for 
Search instead for 
Did you mean: 

CSV Line break

Dogan
Participant
0 Kudos

Hi guys,

how do insert a line break in a csv?

The CSV could look like this:

ID,NAME,DATE,TEXT1

123,John Doe,20211021,This is a longer text "INSERT LINEBREAK" The text continues

I already tried \n, \u00a but none of them work.

Thanks in advance

Regards

Cemre

chgeo
Advisor
Advisor
0 Kudos

CSV does not really specify handling for the newline character, this is why I think CAP's csv parser does not support it for now.

More important is the question where the \n shall appear in your app (Fiori UI, only API responses etc.). Have you tested this? You could e.g. add a newline char on the DB and see if it appears properly.

0 Kudos

Hello Mr Georgi,

according to this document, which many consider the generally-accepted CSV standard, line breaks in CSV files are handled by wrapping the text in quotes:

"one value
over two lines";next value

Microsoft Excel follows this procedure as well and given the popularity of that software among SAP clients, I think you would do your customers a great favor by using the method, too. At least I would be grateful.

Regards,

Fabian Zimmermann

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

In SQL, you might want to use the CHAR() function, most likely CHAR(10):

insert into mytab values ( 'first line' || char(10) || 'second line' );
Dogan
Participant
0 Kudos

Hi christian.georgi,

the \n should appear in the Fiori UI.

I already tested it but the UI shows me \n and not the actual line break.

chgeo
Advisor
Advisor
0 Kudos

So this is the first problem. Check a) if the UI can display line breaks at all in this place and b) how you can get a real line break in the data. Maybe it's not the literal \n that you need to use in the DB, but a real line break character.

P.S. Please change your answer to a comment (→ Actions). This is not an answer in the forum's sense.