2010 Nov 13 5:29 PM
Hi Gurus,
Can anyone please let me know is there any FM or any program for the below kind of requirement ?
Let us say I have a Text ( change dynamically ) with 150 charecters length. However It is split into 3 parts of each 50.
I would like to have only the complete words in each part.
Example - My text is " Approximately 72.4% from a total of 1,226.7 million shares outstanding are in free float "
It should be as " Approximately 72.4% from a total of 1,226.7 million " in Part1
and " shares outstanding are in free float " in part2.
but currently it is happening as " " Approximately 72.4% from a total of 1,226.7 mil " in part1
and " lion shares outstanding are in free float " in part2.
Kindly suggest me how to handle this situation.
Kind regards,
Varun
Hi Gurus,
Can anyone please let me know is there any FM or any program for the below kind of requirement ?
Let us say I have a Text ( change dynamically ) with 150 charecters length. However It is split into 3 parts of each 50.
I would like to have only the complete words in each part.
Example - My text is " Approximately 72.4% from a total of 1,226.7 million shares outstanding are in free float "
It should be as " Approximately 72.4% from a total of 1,226.7 million " in Part1
and " shares outstanding are in free float " in part2.
but currently it is happening as " " Approximately 72.4% from a total of 1,226.7 mil " in part1
and " lion shares outstanding are in free float " in part2.
Kindly suggest me how to handle this situation.
Kind regards,
Varun
2010 Nov 13 6:05 PM
Hi
I don't know if there's a fm, but you can try something like this:
DATA text(150).
DATA: part1(50), part2(50).
DATA: offset TYPE i.
text = 'Approximately 72.4% from a total of 1,226.7 million shares outstanding are in free float'.
PERFORM set_part USING part1 0.
PERFORM set_part USING part2 offset.
WRITE: part1, / part2.
FORM set_part USING p_part p_offset TYPE i.
DATA: last_char(1).
DATA: l_offset TYPE i.
DATA: pos TYPE i.
l_offset = p_offset + 50.
last_char = text+l_offset(1).
WHILE last_char <> space.
l_offset = l_offset - 1.
last_char = text+l_offset(1).
ENDWHILE.
pos = l_offset - p_offset.
p_part = text+p_offset(pos).
offset = p_offset + pos.
WHILE p_part(1) = space.
p_part = p_part+1.
ENDWHILE.
ENDFORM. " SET_PART
Max
2010 Nov 14 4:19 AM
What is the FM you're using? Did you try the FM 'RKD_WORD_WRAP' ?
Output of the text you've provided(splitting into blocks of 50 chars) will be
Approximately 72.4% from a total of 1,226.7
million shares outstanding are in free float
2010 Nov 15 10:03 AM
I used - CRM_MESSAGE_TEXT_SPLIT and it solved the purpose. Thanks - Varun
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |