‎2008 Mar 07 7:32 AM
Hi
I want to pick up decimals only in packed value.
Example
data: I_TOTAL LIKE J_1ITAXVAR-J_1ITAXAM1.
round off bellow value to my conditions.
if value is 1994.50 and bellow .50. i want to change 1994.
if value is 1994.51 and above .51 then only change to 1995
which function module works like as above my conditions.
or send to the detail code
Please send me as early as possible.
Regards,
Hari
‎2008 Mar 07 7:36 AM
Hi,
Use Ceil of floor or round.
do like this
data: x type p decimals 2.
x = frac(i_total).
if x <= 0.5.
floor(i_total).
else
ceil(i_total).
endif.
Regards
‎2008 Mar 07 7:37 AM
data: a TYPE p VALUE '12.49'.
data: b TYPE i.
b = a.
WRITE b.
reward points please....
‎2008 Mar 07 7:49 AM
Declare a variable with Type P and pass the value to that variable, You can see the changes.
Regards
Vinayak
‎2008 Mar 07 7:52 AM
hi ,
this is more appropriate that what u what.
parameters:p_test type p decimals 2,
output(15).
output = p_test.
write:/ output.
reward points if useful,
venkat.
‎2008 Mar 07 7:55 AM
Hi,
define one local variable with type i,
then move your value to this varible then automaticaly it shows like round figure.
ex:
data: I_TOTAL LIKE J_1ITAXVAR-J_1ITAXAM1 value '1994.51',
l_variable type i.
l_variable = I_TOTAL.
here i_variable becomes 1995, that's it no need with FM.
seshu.
‎2008 Mar 07 8:02 AM
hi,
HR_ROUND_NUMBER Rounds a number according to rules
ROUND Rounds value to a number of decimal places
ROUND_AMOUNT Rounding based on company and currency
UNIT_CONVERSION_SIMPLE Converts measurement unit values and rounds
Hope this is helpful, Do reward.