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

How to create CSV data with a cell including two rows?

Former Member
0 Likes
1,571

Hi guys,

i am creating CSV using "comma" as seperator for columns, "return" as seperator for rows.

But how can I create a cell which includes two rows?

I want to do following:

cell1 cell2 cell3

XXXXX YYYYY ZZZZZ

in cell2 YYYYY, there are two sub rows:

YLine1.1 YLine1.2 YLine1.3

YLine2.1 YLine2.2 YLine2.3

Which kind of seperator can I use for these sub rows?

so to say(XML mode):

<row>

<Col1>XXXXX</Col1 >

<Col2>

<row>

<col1>YLine1.1</col1>

<col1>YLine1.2</col1>

<col1>YLine1.3</col1>

</row>

<row>

<col1>YLine2.1</col1>

<col1>YLine2.2</col1>

<col1>YLine2.3</col1>

</row>

</Col2 >

<Col3>ZZZZZ</Col3 >

</row>

It is very kind of you to give me some hint!

Regards,

Liying

Message was edited by:

Liying Wang

Message was edited by:

Liying Wang

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,033

Hi

I don't believe it can do it by CSV, because I don't believe this format can manage row with cells with several rows.

Max

Hi guys,

i am creating CSV using "comma" as seperator for columns, "return" as seperator for rows.

But how can I create a cell which includes two rows?

I want to do following:

cell1 cell2 cell3

XXXXX YYYYY ZZZZZ

in cell2 YYYYY, there are two sub rows:

YLine1.1 YLine1.2 YLine1.3

YLine2.1 YLine2.2 YLine2.3

Which kind of seperator can I use for these sub rows?

so to say(XML mode):

<row>

<Col1>XXXXX</Col1 >

<Col2>

<row>

<col1>YLine1.1</col1>

<col1>YLine1.2</col1>

<col1>YLine1.3</col1>

</row>

<row>

<col1>YLine2.1</col1>

<col1>YLine2.2</col1>

<col1>YLine2.3</col1>

</row>

</Col2 >

<Col3>ZZZZZ</Col3 >

</row>

It is very kind of you to give me some hint!

Regards,

Liying

Message was edited by:

Liying Wang

Message was edited by:

Liying Wang

8 REPLIES 8
Read only

Former Member
0 Likes
1,034

Hi

I don't believe it can do it by CSV, because I don't believe this format can manage row with cells with several rows.

Max

Read only

0 Likes
1,033

Is it really impossible?

Anyway Max Thanks!

Read only

0 Likes
1,033

Hi

I think it's impossible because Excel doesn't allows to split a cell, u can only join two cells.

Max

Read only

0 Likes
1,033

Thanks very much!

I have another question: if the field is seperated by colon. Which kind of tool can I use to check whether CSV data is correct? I use Excel to open CSV if their fields are seperated by semicolon, but it doesn't work if the fields are seperated by colon...

Regards,

Liying

Read only

Clemenss
Active Contributor
0 Likes
1,033

Hi Wang Liying,

I tried with Excel. A Cell with 2 rows saved as CSV shows that the cells contents are enclosed in hyphens "b row 2 b" and the two rows ins one cell are separated with HEX 0A. This is a simple Line feed. The sequence to build this would be in ABAP


concatenate
'"'
<row1>
CL_ABAP_CHAR_UTILITIES=>NEWLINE
<row2>
'"'
into cell.

I did not take the time to try on system, but I tried to open with excel: It works with Windows.

Regards,

Clemens

Read only

Former Member
0 Likes
1,033

Thanks Clemens!

The solution is not the one I wish, it only display the context as two lines. What I wish is to display two "physical" lines...

Anyway, thanks very much!

Regards,

Liying

Read only

Clemenss
Active Contributor
0 Likes
1,033

Hi Wang LiYing,

maybe I do not understand your requirement. The question was about 2 rows in one cell. So I started Excel, put something into a cell and with ALT-Enter created a second line in this cell.

What do you mean by

two "physical" lines?

How does this show in Excel?

Regards,

Clemens

Read only

Former Member
0 Likes
1,033

Hi Clemens,

what I meant is that there are two rows in one cell, these rows are not created by Alt-Enter, but only can be selected by Enter.

But I got to know it is impossoble to do it with CSV data.

Thanks!