cancel
Showing results for 
Search instead for 
Did you mean: 

EHS00_WORDWRAP02

Former Member
0 Kudos

Hi,

I am using this FM to split the material text in my program. If I give length as 40, it gives an internal table as output, with the text split into lines that have length as 40. However, if there is a word at the end of length 40, it also splits that word.

For ex. - text = 'Example text'. and length = 9.

then output table has 2 lines - 'Example t' & 'ext'.

The requirement is, it should not split this word at the end even if it falls in the specified length value. The output should have been - 'Example' and 'Text'.

Is there any other FM that I can use, which can handle this? Or is there any alternative way of handling this?

Thanks and Regards,

Shivali

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi vijay,

I gave input to this FM - RKD_WORD_WRAP as

'TRYING TO SPLIT TEXT INTO SPECIFIED LENGTH', and length as 8 but it still gives the same problem. The output I got it this -

Table with following lines -

TRYING

TO

SPLIT

TEXT

INTO

SPECIFIE

D LENGTH.

It has split the word 'SPECIFIED'.

I cannot use the SPLIT command, as the accommodating length in the sap-script column is 40 and splitting at space will only divide the description into individual words of the sentence. I can concatenate it into a variable, but it will not be feasible as we do not know how long a description of item can be.

Thanks,

Shivali

former_member181962
Active Contributor
0 Kudos

Hi Shivali,

If you can somehow find the length of the longest word in the string, and pass that as the length to the FM , then You can get all the words as different lines.

I gave 9 as the length to the FM and string as

TRYING TO SPLIT TEXT INTO SPECIFIED LENGTH

and I got,

TRYING

TO SPLIT

TEXT

INTO

SPECIFIED

LENGTH

Is that OK?

Regards,

Ravi

Former Member
0 Kudos

try this out

Data: p(20) value 'example date', q(10).

data: j1(10), j2(10) .

split p at ' ' into: j1 j2.

write : / j1 , j2 .

plz reward points if helpful

Message was edited by: Satesh R

Message was edited by: Satesh R

former_member188685
Active Contributor
0 Kudos

Hi,

try with FM<b> RKD_WORD_WRAP</b>

regards

vijay

former_member181962
Active Contributor
0 Kudos

Hi Shivali,

Can you be a bit more clear?

If you want to split the text at a specific character like space, you can use split command.

eg:

DATA: str1 TYPE string,

str2 TYPE string,

str3 TYPE string,

itab TYPE TABLE OF string,

text TYPE string.

text = `What a drag it is getting old`.

SPLIT text AT space INTO: str1 str2 str3,

TABLE itab.