‎2009 Mar 27 7:03 AM
hi sap,
i have a field - objnr -ISTR030000001000007
i need to take out the first 12 characters and keep the last 7 characters.
so how can i do it can you pls tell me
regards,
laya.
‎2009 Mar 27 7:07 AM
Hi,
You can use the offset technique.
Refer:
data : objnr type objnr. "length for objnr is 18
objnr = 'STR030000001000007'.
data : v_str(10) type c.
v_str = objnr+11(7).
write : v_str, objnr.
Regards,
Tarun
‎2009 Mar 27 7:08 AM
Use offsets.
data : v_str1 type string value 'ISTR030000001000007' ,
v_str2 type(12) type c,
v_str3 type(7) type c.
v_str2 = v_str1+0(12).
v_str3= vstr1+13(7).
Write: v_str2, v_str3.Thanks
‎2009 Mar 27 7:11 AM
Hi,
Try this Way..
DATA : l_len TYPE i.
DATA: l_value(7) TYPE c.
DATA l_objnr TYPE CHAR30.
l_objnr = 'ISTR030000001000007'.
l_len = STRLEN( l_objnr ).
l_len = l_len - 7 .
l_value = l_objnr+l_len(7).
WRITE l_value.
‎2009 Mar 27 7:11 AM
Hi,
For this particular case use:
data: v_objnr(7) type c.
v_objnr = objnr+12(7).
Regards.
‎2009 Mar 27 7:14 AM
Hi,
This is simple, hope below code snippet help you out:
data:objnr(19) value 'ISTR030000001000007',
val(7) tyep c.
val = objnr+12(7).write:/ val.
Pooja
‎2009 Mar 27 8:15 AM