Skip to Content

New line while saving text from text editor to transaction SO10.

Jan 09, 2017 at 07:53 AM


avatar image
Former Member

I am trying to save text from a text editor created using CL_GUI_TEXTEDIT Class to Transaction SO10.

If we press enter key for a new line on the text editor and add further text, the text is stored separated by '##' in SO10.

I want the text to be saved in SO10 on a new line as it is in the text editor. and without '##'

Can anyone suggest a solution for the same

Thanks and Regards

Anuja Dhondge

img1.png (4.7 kB)
img2.png (2.4 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Raymond Giuseppi
Jan 09, 2017 at 08:43 AM

To be more precise, how did you get the text and save it

  • How did you map the received flat table to TDLINE structure before SAVE_TEXT?


Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Raymond,

I am using get_textstream method to get the text and then by splitting it into 132 char appending it to tdline.


Anuja Dhondge


So you don't get the line-break, you get a whole string of text with control characters, that you must break to comply with TLINE: break at CR/LF and length defined for the text, add the * at new lines, etc. (...) or look at a FM like C14W_STRING_TO_TLINE or a method like CL_ISH_UTL_BASE=>CONVERT_STRING_TO_LONGTEXT.



I personally use function module CONVERT_STREAM_TO_ITF_TEXT to convert a string to ITF format (long text). The input is a table of strings, and the output table is of type TLINE.

Richard Harper Jan 09, 2017 at 08:07 AM


Look at the ascii code for the # signs. You will find that it is 000A000D which equates to Linefeed/carriage return. The text is being stored exactly as requested.

So, the next question is (and unfortunately I'm not on an SAP system at the moment), but what method are you using to get the text from the text editor to the internal table prior to saving it as a text ?

I can't remember if I had to parse the text and split it at CRLF or not.


Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Richard,

I have used get_textstream method to get the text.


Anuja Dhondge

Nic Teunckens Jan 09, 2017 at 01:48 PM


We encountered some issues as well in interpreting LongTexts, being passed from external (non-SAP) systems for updating SAP-LongText ...

We just identified the double '#' as a "CR_LF" and replaced it to a single '#' ...

See below sample :

"Since issue occurred with (##) we suspect this is a CR_LF issue, which we'll replace by (#).
"Solution is to avoid all 'unexpected character' except NEWLINE (#).
"By Splitting at NEWLINE, we identify a new TDLINE ...

* DATA: crlf(2) TYPE x VALUE '0D0A'.
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>cr_lf IN <longtext>-field_value 
                                                         WITH cl_abap_char_utilities=>newline.

*--> see if this line contains any end of lines
    IF <longtext>-field_value CA cl_abap_char_utilities=>newline.

*--> End of line found, now try and split them to match the longtext structure
      CLEAR lv_longtext_extra_line.
      lv_longtext_extra_line = <longtext>-field_value.
      WHILE lv_longtext_extra_line CA cl_abap_char_utilities=>newline.

*--> Process the next part
SPLIT lv_longtext_extra_line AT cl_abap_char_utilities=>newline 
                             INTO <longtext>-field_value 
*--> Add first part of the line to the table ls_bapi_longtext-tdformat = <longtext>-format_col. ls_bapi_longtext-tdline = <longtext>-field_value(132).
APPEND ls_bapi_longtext TO lt_bapi_longtext.
10 |10000 characters needed characters left characters exceeded