Skip to Content

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

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)
Add comment
10|10000 characters needed characters exceeded

3 Answers

  • Posted on 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?


    Add comment
    10|10000 characters needed characters exceeded

  • Posted on 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.


    Add comment
    10|10000 characters needed characters exceeded

  • Posted on 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.
    Add comment
    10|10000 characters needed characters exceeded