‎2005 May 16 8:53 PM
Hi,
I'm looking for a substring command in ABAP.
I have a string like this...
text = 'hello, how are you today'.
Here's my goal...
I want to separate my string at the 10th character into two strings (text1 and text2).
so the result would be
text1 has the value 'hello, how'
text2 has the value ' are you today'
of course, the characters in the string 'text' will vary.
Can anyone help?
Thanks.
Audrey
‎2005 May 16 9:04 PM
Hi Audrey
You can use offset and length additions.
DATA lv_str TYPE string .
lv_str = 'hello, how are you today' .
write:/ lv_str+7 ,
/ lv_str+7(3) ,
/ lv_str(7) .The output should be:
how are you today
how
hello,Regards
*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>
‎2005 May 16 9:03 PM
‎2005 May 16 9:04 PM
Hi Audrey
You can use offset and length additions.
DATA lv_str TYPE string .
lv_str = 'hello, how are you today' .
write:/ lv_str+7 ,
/ lv_str+7(3) ,
/ lv_str(7) .The output should be:
how are you today
how
hello,Regards
*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>
‎2005 May 17 7:27 AM
Ho Audrey,
or try this:
DATA text(80).
DATA: BEGIN OF tx,
text1(10),
text2(70),
END OF tx.
text = 'hello, how are you today'.
WRITE : / text.
ULINE.
MOVE text TO tx.
WRITE: / tx-text1.
WRITE: / tx-text2.regards Andreas
‎2005 May 17 7:43 AM
Hi,
Have a look at this link
http://goldenink.com/abap/substring.html
Also refer http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap for power users
.
Thanks & Regards,
Judith.
‎2005 May 18 5:06 PM