05-27-2008 10:58 PM
Hello,
Does anyone know a standard string FM that split string at an absolut place and consider if the N place is blank or not ?
My meaning is likely:
str = 'test one two three'.
I would like to split str at the 10th place but because it's in a middle of word split it in the 8th place ..
str1 = 'test one'
str2 = 'two three'
and not
str1 = 'test one t'
str2 = 'wo three'
I know that VB has few methods like that, I'm hope abap has it also ..
Thanks in advance,
Rebeka
05-27-2008 11:11 PM
05-27-2008 11:11 PM
05-27-2008 11:31 PM
Hi Rebeka,
Please check the following code. This would help. FM 'TEXT_SPLIT' does it correctly.
DATA: text(50) TYPE c VALUE 'test one two three',
text1(20) TYPE c,
text2(20) TYPE c.
CALL FUNCTION 'TEXT_SPLIT'
EXPORTING
LENGTH = 10
TEXT = text
AS_CHARACTER =
IMPORTING
LINE = text1
REST = text2
.
check sy-subrc = 0.
write : text1 ,
text2.
Reward points if useful.
Regards
Abhishek