Application Development 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 Text Function Module

Former Member
0 Kudos
290

Hi All,

I am using Read_Text FM and fetching some text from CRMD_ORDER. My Problem is, we need to have the text in the below format.

For Eg -  ( Hi Good Morning

    

                      Have a nice day!!!

                  Thank You ).

The output of my program is Excel Sheet  and the client wants to get the above text in one cell and in the same format of the excel sheet and not in the Rows.

Below image will help to understand more.

Kindly Help!!

Thanks and Regards.

7 REPLIES 7

ziolkowskib
Active Contributor
0 Kudos
90

Hi,

As I understand it all the three lines of text you mentioned are read from text as separate lines of text table correct? If so have you tried concatenating them with CL_ABAP_CHAR_UTILITIES=>NEWLINE before putting the content into cell?

Do you use XLSX or XML 2003 format of Excel file?  

0 Kudos
90

Hi Bartosz,

Thank you for your Reply,

Yes , you are  right all the three lines are read as separated lines in the internal table.

As well I  tried concatenating them with CL_ABAP_CHAR_UTILITIES=>NEWLINE, but it is converting it like below which they don't want it.

We are using .csv format to convert into excel.

Regards

0 Kudos
90

If you want to use new line in a cell of CSV you must put its content between quotes " " - it should fix your issue.

0 Kudos
90

Hi,

I tried using the Quotes ' " " ', but still it has not resolved my issue..

I am getting it in straight line.

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos
90

CL_ABAP_CHAR_UTILITIES=>NEWLINE is kinda outdated, you can use |\n| instead,


see the example in the documentation.

0 Kudos
90

Please open your CSV file using Notepad++ (or any other decent text editor) with option of displaying special characters and take a screenshot of that and paste it here.

Most probably there is some minor detail that corrupts the result.

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos
90

text = |{ text1 }\n{ text2 }\n{ text3 }\n ...|.

see String Templates - control_characters