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: 

Round up factor

Former Member
0 Kudos

Hi all,

here is what I'm looking for: On my selection screen I have a parameter of a round-up factor. With this factor I need to round a quantity. If for example I have a quantity of 2.26 and my factor is 25% it should go to 2.5.

Can anyone help how to do this?

Thanx!

1 ACCEPTED SOLUTION

Former Member
0 Kudos

what exactly do u men by 25% as round faactor.....can explain indetail

6 REPLIES 6

Former Member
0 Kudos

what exactly do u men by 25% as round faactor.....can explain indetail

0 Kudos

to round the quantity to the closest 25%. So like my example 0.2662 would be 0.5 and 0.657 would be 0.75.

0 Kudos

take an integer type and move the original value into a dummy variable say dummy of the original variable type.

data a, b type i.

dummy = 2.26

b = dummy - 0.5. " b = 2

a = ( dummy - b ) * 100. " a = 26

now u have write if else block to see whether 'A' is in between 0-25, 25-50, 50-75, 75-100.

if a bt 0 and 25.

a = 25.

elseif a bt 25 and 50.

a = 50.

...

....

endif.

dummy = b + ( a / 100 ).

copy back dummy to its original value.

Former Member
0 Kudos

<deleted>

Message was edited by:

Chandrasekhar Jagarlamudi

0 Kudos

that is not what i want please look at my examples given above.

Former Member
0 Kudos

qty    = '2.55'.
tmp    = qty mod 1.
qty    =  qty DIV 1.

if tmp > '0.50'
qty    = qty+1.
endif.

Edited by: Priyanka Chowdry on Jun 18, 2008 6:23 AM