10-13-2008 6:27 AM
Hi Friends,
I wan to split one word from a character occurring inside the word. For example , I want to split the following word from '_' . 'PROPERT_METH' . i.e, into PROPERTY , METH.
How can i do this.....
Thanks,
Brij...
10-13-2008 6:30 AM
Hi Soni
try this
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.
10-13-2008 6:28 AM
10-13-2008 6:30 AM
Hi Soni
try this
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.
10-13-2008 6:31 AM
Hi,
You can use the SPLIT at statement.
Since your delimiter is '_'... you can say
Split w_word at c_under into w_word1 w_word2.
Regards,
Pramod
10-13-2008 6:32 AM
SPLIT str AT '-' INTO TABLE str1 str2.
where str is input string.
Regards,
Aparna.
10-13-2008 6:35 AM
Hi,
You can use anyone of the below syntaxes:
1. Split <variable> at '_' into var1 var2 ... var.
2. Split <variable> at '_' into itab.
(where itab is like:
data: begin of wa,
var(255),
end of wa.
data: itab like standard table of wa with header line.)
I consider 2nd option to be best.
ITAB contains all the splitted variables as diff records.
Thanks & Regards,
Navneeth K.
10-13-2008 6:35 AM
Hi,
look at this sample code.
data: text(255).
data: v_x.
text = 'AA,17,2/19/2003,"9,999.00",USD,00,10,318,"193,275.31"'.
do.
v_x = ' '.
search text for '"' and mark.
if sy-subrc = 0.
replace first OCCURRENCE OF '"' in section offset sy-fdpos of text with
''.
replace first OCCURRENCE OF ',' in section offset sy-fdpos of text with
''.
replace first OCCURRENCE OF '",' in section offset sy-fdpos of text with
','.
v_x = 'X'.
endif.
if v_x = ' '.
exit.
endif.
enddo.
write:/ text.
regads
satish