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

Adding newline and tab characters to a string

Former Member
0 Likes
2,642

Hi,

I have a silly problem. I am reading data from an internal table and would like to put it in a CSV file for download. I am reading the data into a string object. I need to delimit the string by the column delimiter (tab character) and the rows by the row delimiter (new line character). What characters do i use for these?

Thanks in advance for your help.

Shailesh

PS:- I am not able to use the hexadecimal separator since when i loop through the table and assign columns to my field symbol, it expects the assignation to be made to a string and not xstring.

Message was edited by: Shailesh Unny

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,797

You can use some attributes from the class cl_abap_char_utilities.


cl_abap_char_utilities=>horizontal_tab 
cl_abap_char_utilities=>CR_LF

Regards,

Rich Heilman

6 REPLIES 6
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,798

You can use some attributes from the class cl_abap_char_utilities.


cl_abap_char_utilities=>horizontal_tab 
cl_abap_char_utilities=>CR_LF

Regards,

Rich Heilman

Read only

0 Likes
1,797

Thanks Rich. It worked perfectly. One more question. I have a column which will have a lot of text including newline characters. Is there any way to ensure that after download this stays in the same column (in excel) ?

Read only

0 Likes
1,797

The newline character within the field may cause you are a problem. Have you tested this yet? You may have to remove these characters before downloading.

Regards,

Rich Heilman

Read only

0 Likes
1,797

Yes. In one column of the Table there is a lrge string with new line characters. I would like to download this entire string into a single column in excel. I can remove/translate the newline characters in this column. My question was is there any way to replace them when the download is being prepared?

Thanks again for your help.

Read only

0 Likes
1,797

You will need to handle the remove/translating of the newline characters directly in your internal table, before you download.

Regards,

Rich Heilman

Read only

0 Likes
1,797

Thanks a lot Rich. You have been very helpful.