03-15-2007 11:17 AM
Hi,
Will you please tell me, how I can use Offset like command for the following code :-
Data :- v_file type string .
Let v_file = xyz/abc/ABCD/pq.rs.tuv1234
I want to take last 7 digit i.e. "tuv1234"
Please tell me..
Saurabh
03-15-2007 11:19 AM
data : text(40) type c value 'gashscj/kdkkl223',
length type i,
value(7).
length = strlen( text ).
length = length - 7.
value = text+length(7).
regards
shiba dutta
Message was edited by:
SHIBA DUTTA
03-15-2007 11:19 AM
data : text(40) type c value 'gashscj/kdkkl223',
length type i,
value(7).
length = strlen( text ).
length = length - 7.
value = text+length(7).
regards
shiba dutta
Message was edited by:
SHIBA DUTTA
03-15-2007 11:19 AM
Hi,
Count the total length of the string and use the offset.
here total is 26
Let v_file = xyz/abc/ABCD/pq.rs.tuv1234
so use String = v_file+19(7).
Regards,
Anji
03-15-2007 11:21 AM
Hello,
U can do like this:
DATA : V_FILE TYPE STRING .
DATA: LEN TYPE I.
V_FILE = 'xyz/abc/ABCD/pq.rs.tuv1234'.
LEN = STRLEN( V_FILE ).
LEN = LEN - 7.
WRITE: V_FILE+LEN(7).
If usefulreward.
Vasanth
03-15-2007 11:21 AM
03-15-2007 11:22 AM
Try something like
DATA: v_file TYPE string,
extract TYPE string,
len TYPE i.
v_file = 'xyz/abc/ABCD/pq.rs.tuv1234'.
COMPUTE len = strlen( v_file ) - 7.
extract = v_file+len(7).
Regards
03-15-2007 11:23 AM
Hi,
Data : v_file type string .
v_file = 'xyz/abc/ABCD/pq.rs.tuv1234'.
v_file = v_file+19(7).
write:/ v_file.
Regards,
Sruthi
03-15-2007 11:23 AM
HI,
v_len = strlen( field-name ).
v_len = v_len - 6.
offset = BSIS-BUDAT+v_len(7).
Kishore
03-15-2007 11:25 AM
you can also use this FM to get the extension of a file
<b>SDOK_FILE_NAME_EXTENSION_GET</b>
03-15-2007 11:45 AM
In addition to the answers above. Check that the filled length of the source field is 7 or greater. Trying to extract from a negative offset is meaningless.
MattG.