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

Round up factor

Former Member
0 Likes
846

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
Read only

Former Member
0 Likes
811

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

6 REPLIES 6
Read only

Former Member
0 Likes
812

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

Read only

0 Likes
811

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.

Read only

0 Likes
811

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.

Read only

Former Member
0 Likes
811

<deleted>

Message was edited by:

Chandrasekhar Jagarlamudi

Read only

0 Likes
811

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

Read only

Former Member
0 Likes
811

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