‎2008 Nov 21 5:07 AM
String1 = ABC/12222ASDF
String2 = EF/1234W3RSDFASDF
String3 = ABCD/22343DFGADG
.......
I want to get each string's chars before the symbol '/' . Use which ABAP char operation,Please help me.
Thanks,Have a nice day.
‎2008 Nov 21 5:08 AM
Hi Bean,
Use SPLIT statement.
Thanks
Edited by: Nitesh Kumar on Nov 21, 2008 10:38 AM
‎2008 Nov 21 5:08 AM
Hi Bean,
Use SPLIT statement.
Thanks
Edited by: Nitesh Kumar on Nov 21, 2008 10:38 AM
‎2008 Nov 21 5:11 AM
Hi Bean,
Refer this code snippet.
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.
P.S. Replace Space by '/' to split your string.
Thanks
‎2008 Nov 21 5:26 AM
‎2008 Nov 21 5:27 AM
hello bean,
greetings of the day,
split is the command used for this solution.
try using this code :
data : string1(15),string2(15),string3(15).
data: str1(5),str2(15).
String1 = 'ABC/12222ASDF'.
String2 = 'EF/1234W3RSDFASDF'.
String3 = 'ABCD/22343DFGADG'.
.......
split string1 at '/' into str1 str2.
write:/ 'characters before / in string1 are :' , str1.
split string2 at '/' into str1 str2.
write : /'characters before / in string2 are :' , str1.
split string3 at '/' into str1 str2.
write 😕 'characters before / in string3 are :' , str1.
thanks
geeta
‎2008 Nov 21 5:28 AM
Hi,
Check the below code I have written it according to your requirement.
REPORT ZRET_CHAR_F_STG.
data: string1 type string,
string2 type string,
string3 type string,
string4 type string,
string5 type string,
string6 type string,
string7 type string,
string8 type string,
string9 type string,
sep type c.
data: l1 type i,
l2 type i,
l3 type i.
data: c1 type c,
c2 type c,
c3 type c.
String1 = 'ABC/12222ASDF'.
String2 = 'EF/1234W3RSDFASDF'.
String3 = 'ABCD/22343DFGADG'.
sep = '/'.
split string1 at sep into string4 string5.
split string2 at sep into string6 string7.
split string3 at sep into string8 string9.
l1 = strlen( string4 ).
l1 = l1 - 1.
c1 = string4+l1(1).
l2 = strlen( string6 ).
l2 = l2 - 1.
c2 = string6+l2(1).
l3 = strlen( string8 ).
l3 = l3 - 1.
c3 = string8+l3(1).
Write:/ c1, c2, c3.
Write:/ string4, string5.
Write:/ string6, string7.
Write:/ string8, string9.Cheers,
Murthy.
‎2008 Nov 21 5:28 AM
‎2008 Nov 21 5:41 AM
Hi,
check the following sample:
data: string1 type string,
string2 type string,
string3 type string,
str1_1 type string,
str1_2 type string.
String1 = 'ABC/12222ASDF'.
String2 = 'EF/1234W3RSDFASDF'.
String3 = 'ABCD/22343DFGADG'.
SPLIT string1 AT '/' INTO: str1_1 str1_2 .
write: str1_1, str1_2.Regards,
Chris Gu