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

SPLIT for line break on ##

alpaca
Product and Topic Expert
Product and Topic Expert
0 Likes
5,170

Hi everybody

I tried to create a message for an internal abap ticket system.

The message is entered by an user on a bsp site. The Function module i have to use only takes the message as a table of char200 lines. So i have to put every 200 chars in another line of the table.

The problem is: I can't recognize the line breaks of the HTML. They are in the String from the site as ##. I tried the following: The split statement does not recognize the ## and does not split properly. can anyone please help? help will be rewarded!

while split_while = 'X'.

    clear lwa_text2.
    lwa_text = lv_html.
    replace all occurrences of lwa_text in lv_html with ''.

    "add new lines on '##'
    split lwa_text at '##' into table lt_split in character mode.
    if lt_split is initial.
      loop at lt_split into lwa_text.
        append lwa_text to lt_text.
      endloop.
    else.
      append lwa_text to lt_text.
    endif.


    if lv_html is initial.
      clear split_while.
    endif.
  endwhile.

THANKS a lot !

Best Regards

1 ACCEPTED SOLUTION
Read only

Former Member
2,411

Try to use the CL_ABAP_CHAR_UTILITIES=>CR_LF instead of ##.

use:

split lwa_text at CL_ABAP_CHAR_UTILITIES=>CR_LF into table lt_split in character mode.

instead:

split lwa_text at '##' into table lt_split in character mode.

Regards,

Joy.

Hi everybody

I tried to create a message for an internal abap ticket system.

The message is entered by an user on a bsp site. The Function module i have to use only takes the message as a table of char200 lines. So i have to put every 200 chars in another line of the table.

The problem is: I can't recognize the line breaks of the HTML. They are in the String from the site as ##. I tried the following: The split statement does not recognize the ## and does not split properly. can anyone please help? help will be rewarded!

while split_while = 'X'.

    clear lwa_text2.
    lwa_text = lv_html.
    replace all occurrences of lwa_text in lv_html with ''.

    "add new lines on '##'
    split lwa_text at '##' into table lt_split in character mode.
    if lt_split is initial.
      loop at lt_split into lwa_text.
        append lwa_text to lt_text.
      endloop.
    else.
      append lwa_text to lt_text.
    endif.


    if lv_html is initial.
      clear split_while.
    endif.
  endwhile.

THANKS a lot !

Best Regards

4 REPLIES 4
Read only

Former Member
2,412

Try to use the CL_ABAP_CHAR_UTILITIES=>CR_LF instead of ##.

use:

split lwa_text at CL_ABAP_CHAR_UTILITIES=>CR_LF into table lt_split in character mode.

instead:

split lwa_text at '##' into table lt_split in character mode.

Regards,

Joy.

Read only

Former Member
0 Likes
2,411

SAP usually uses the # symbol for special characters that it can't interpret. Try having a look in class CL_ABAP_CHAR_UTILITIES at the attributes. A common one is the Carriage Return / Line Feed characters.

Read only

Subhankar
Active Contributor
0 Likes
2,411

You can use FM "RKD_WORD_WRAP" to split the text

CALL FUNCTION 'RKD_WORD_WRAP'

EXPORTING

textline = wa_final-ldesc

outputlen = 72

TABLES

out_lines = i_outlen

EXCEPTIONS

outputlen_too_large = 1

OTHERS = 2.

Read only

alpaca
Product and Topic Expert
Product and Topic Expert
0 Likes
2,411

he guys:)

thanks a lot !! 3 very helpful answers rewarded !