2007 Sep 19 2:51 PM
Hi,
I need to round off some value. For eg. if the value is .123456(Six Decimal Places) ; answer should be 0.12346(Five Deci Places).
So is there any standard Function module to achieve the same?
Thanks in advance.
Jigar
Hi,
I need to round off some value. For eg. if the value is .123456(Six Decimal Places) ; answer should be 0.12346(Five Deci Places).
So is there any standard Function module to achieve the same?
Thanks in advance.
Jigar
2007 Sep 19 2:53 PM
2007 Sep 19 2:54 PM
Hi
Check the MATHS function CEIL or FLOOR
following maths functionas are there in SAP:
abs -Absolute value of the argument arg
sign- Plus/minus sign of the argument arg: -1, if the value of arg is negative; 0 if the value of arg is 0; 1 if the value of arg is positive.
ceil -Smallest integer number that is not smaller than the value of the argument arg.
floor- Largest integer number that is not larger than the value of the argument arg.
trunc- Value of the integer part of the argument arg
frac- Value of the decimal places of the argument arg
Regards
Anji
2007 Sep 19 2:54 PM
write field to charvar decimals 5.
*declare a charecter type variable and move the field to that variable in above way....
Regards
vasu
2007 Sep 19 2:54 PM
Hi,
Please try these FM.
FI_ROUND_AMOUNT
ROUND
ROUND_AMOUNT
HR_NZ_ROUNDING_DECIMALS
Regards,
Ferry Lianto
2007 Sep 20 1:00 PM
Hi
THanks a lot for your quick response.
But as per my requirement;
there is a char data type with lenght 16 in which last seven digits are to considered as if they are after decimal point.
For eg. value is : 0000000000011173 ; then First nine charaters 000000000 are before decimal point and last seven characters 0011173 are after decimal point. So I would like to have answer as 000000000.00112. i.e we need to round of the given value such a way that only 5 digits are there after decimal point.
Thanks in advance
2007 Sep 20 1:20 PM
Hi,
Try with this:
DATA pack TYPE p VALUE '123.456'
DECIMALS 3.
WRITE pack DECIMALS 2.
WRITE: / pack ROUND -2,
/ pack ROUND -1,
/ pack ROUND 1,
/ pack ROUND 2.
Regards,
Bhaskar
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |