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,
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 -
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.
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.
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,