Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

extracting last 4 digits

naveenvishal
Contributor
0 Kudos

how can i extract last 4 letters from i tab.

e.g.

xxxxINST

xxYYYY

xxINST

xxYYYY

xxxxxxINST

want ot extract rows with ending 'INST'...

Thanx,

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

get the string length of the the variable.

say the string length is 20

then

data: v_str(20) type c.

data: v_off(4) type c.

v_off = v_str+16(4).

v_off will have the last four chars

regards,

theja

5 REPLIES 5

Former Member
0 Kudos

hi,

get the string length of the the variable.

say the string length is 20

then

data: v_str(20) type c.

data: v_off(4) type c.

v_off = v_str+16(4).

v_off will have the last four chars

regards,

theja

Former Member
0 Kudos

use offset

in itab

first find length of the string using strlen

var = length-4

string+var(4).

Madhavi

Former Member

HI,

data:str(20).

data:num(2) type n.

num = strlen( str ).

num = num - 4.

write:/ str+num.

rgds,

bharat

Former Member

data : v_leng type i,

v_offset(2) type n,

v_reqired(4) type c.

v_leng = strlen(itab-field).

v_offset = v_leng - 4.

v_required = itab-field+v_offset(4).

Rgds,

Bujji

Former Member
0 Kudos

Hi,

Loop at itab.

condense itab-text.

len = strlen( itab-text ).

len = len - 4.

val = itab-text+len(4).

If val = 'INST'.

.......

do the required operation.

.....

endif.

Endloop.

Edited by: Ramesh Hirial on Jan 31, 2008 4:56 PM