08-09-2006 5:32 PM
Hi Experts,
Here is a string:
<field name = "Catalog ID" isUserMetadata="true"><![CDATA[0101]]></field>
I want to extract 0101 from that .
How can we do this?
08-09-2006 5:36 PM
<field name = "Catalog ID" isUserMetadata="true"><![CDATA[0101]]></field>
Logic :
1. Split the data using '>' into lv1, lv2, lv3.
2. v2 would have the data '![CDATA[0101]]'
3. split the data v2 using [ into v1 v2 v3.
4. v2(4) is your data.
Regards
Anurag
08-09-2006 5:39 PM
data: TheString type string.
TheString = YourString.
SEARCH TheString FOR '0101'.
write: / 'Value starts at: ' , sy-fdpos.
08-09-2006 5:43 PM
Try this..
report zSTRING.
data: zstring type string value
'<field name = "Catalog ID" isUserMetadata="true"><![CDATA[0101'.
data: w_len type i,
w_off type i,
w_var(4).
w_len = strlen( zstring ).
search zstring for '[CDATA[' and mark.
w_off = sy-fdpos + 7.
w_var = zstring+w_off(4).
write:/ w_var.
]]>
~Suresh