Application Development and Automation 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: 
Read only

dynamic field length

Former Member
0 Likes
1,893

Hi I have a text field which have legth 150 . it gets filled fully or partially. and finally i want to take only the last ten digits of the filled message into another variable. please let me know the way.

tehre is no fixed length it is flled dynamically

eg error in the material whcih have the number as 4000888

here i want the last 10 characters to be taken.

the length of this message can varry

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,196

Hi,

you can use strlen function and can take that length in a variable then you can take the last ten words.

hope this will solve your prob.

4 REPLIES 4
Read only

Former Member
0 Likes
1,197

Hi,

you can use strlen function and can take that length in a variable then you can take the last ten words.

hope this will solve your prob.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,196

Try this way:

DATA:
V_IP_TXT TYPE STRING,
V_OFF TYPE I,
V_OP_TXT TYPE STRING.

V_OFF = STRLEN( V_IP_TXT ) - 10.

V_OP_TXT = V_IP_TXT+V_OFF(10).

WRITE: 
/ V_IP_TXT,
/ V_OP_TXT.

Read only

Former Member
0 Likes
1,196

Try this:

PARAMETERS: x(150) type c.

data: var1(150) type c,

var2(10) type c.

var1 = STRLEN( x ).

var2 = STRLEN( x ) - 10.

x = x+var2(var1).

write: x.

Hope this might help...

Read only

Former Member
0 Likes
1,196

Hi Revanth....

Try this piece of code...

data : string type string.

data : string1 type string.

data : len type i.

data : offset type i.

string = 'fdshfjfhjh34876384yfdi3jhf80'.

len = strlen( string ).

offset = len - 10.

string1 = string+offset(10).

write string1.

This should resolve your problem..