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

remove last 4 digits

Former Member
0 Likes
2,657

Hi all,

I want to remove last 4 digits from my numerical no. how can i do this?

Plz help me.

1 ACCEPTED SOLUTION
Read only

former_member156446
Active Contributor
0 Likes
1,791

lv_data type i,

lv_len type i.

lv_data = '1234567'.

lv_len = strln( lv_data ).

lv_data = lv_data+0( lv_len - 4).

write:/ lv_data.

output: 123.

Hi all,

I want to remove last 4 digits from my numerical no. how can i do this?

Plz help me.

5 REPLIES 5
Read only

former_member156446
Active Contributor
0 Likes
1,792

lv_data type i,

lv_len type i.

lv_data = '1234567'.

lv_len = strln( lv_data ).

lv_data = lv_data+0( lv_len - 4).

write:/ lv_data.

output: 123.

Read only

Former Member
0 Likes
1,791

hello,

you can try the following function module:

CONVERSION_EXIT_ALPHA_INPUT

where you can pass the input parameter as the field of the desired size and pass that in the output parameter.

Read only

Former Member
0 Likes
1,791

hi

good

w_level_03 = strlen( W_STRING ).

lv_offset = w_level_03 - 4.

w_string2 = w_string +(lv_offset).

or

w_string2 = w_string +0(lv_offset).

Eg:-

str = "testing1234".

int offset = strlen( str ) - 4.

str = str+0(offset).

thanks

mrutyun^

Read only

Former Member
0 Likes
1,791

Ankita,

v_num TYPE i,

v_len type i.

v_num = '123456756'.

v_len = strln( v_num ).

v_len = v_len - 4

v_num = v_num+0(v_len).

write:/ v_num.

Read only

Former Member
0 Likes
1,791

Hi,

CONVERSION_EXIT_ALPHA_OUTPUT

This Function module is reverse of CONVERSION_EXIT_ALPHA_INPUT , it removes the zeroes which are to the left of the numeric string, converting that string left justified . For non-numeric (including alphanumeric) string it has no effect.

For Eg :

’ABCD ’ is converted as ‘ABCD ’ while outputting.

Try it

U'll get it

Rohini.