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

Nearest integer number

Former Member
0 Likes
942

Hi All,

I want a FM which will give me the nearest integer number.

E.g 2.3 will give 2.

REgards,

Jeetu

1 ACCEPTED SOLUTION
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
919

out type i.

val = 2.3.

out = CEIL( val ).

out = FLOOR( Val ).

write : out.

CEIL and FLOOR is not helpful, the nearest integer to 2.8 will be 3, the nearest interger to 2.2 will be 2. If you have a varaible, which function do you wanna use?

Round is the correct answer, ceil and floor nonsense in this case.

6 REPLIES 6
Read only

JozsefSzikszai
Active Contributor
0 Likes
919

hi,

you can use FM ROUND.

hope this helps

ec

Read only

Former Member
0 Likes
919

You don't need a FM. Use the ABAP statements CEIL and/or FLOOR.

Regards,

John.

Read only

Former Member
0 Likes
919

Use .. FLOOR

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
920

out type i.

val = 2.3.

out = CEIL( val ).

out = FLOOR( Val ).

write : out.

Read only

0 Likes
919

CEIL and FLOOR is not helpful, the nearest integer to 2.8 will be 3, the nearest interger to 2.2 will be 2. If you have a varaible, which function do you wanna use?

Round is the correct answer, ceil and floor nonsense in this case.

Read only

0 Likes
919

Hi,

CEIL and FLOOR statements are used within fm ROUND

Best regards..

Edited by: pablo casamayor on Jul 3, 2008 10:54 AM