on 04-11-2008 1:19 PM
Dear friends,
I am using the standard multiply function and gives the wrong output if input value is more than 6 digits. I am simply multiplying by 100.
Any alternate solution for this? I have also tried with UDF, but no success.
I will appreciate if any one can explain why this function behaves like this.
Regards,
Sarvesh
Hi,
maybe this helps:
/people/thorsten.nordholmsbirk/blog/2006/04/03/never-ever-use-xis-built-in-arithmetic-functions
Regards
Patrick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Message Mapping uses float values which are not very precise.
It's even described in SAP Help:
> Also note that Java values of type float are converted to the second system before the calculation. The result is calculated there and then this result is converted back to decimal format. The conversion may result in positions after the decimal point that are periodically repeated and then automatically cut off. In the decimal system, this can result in inaccurate results (example: 2.11 + 22.11 = 24.220001). If the number of positions after the decimal point is to be restricted to two, for example, in the case of values for a currency, you can format the values after the calculation by using the standard function FormatNum.
If you use double values in User-Defined-Functions it's not much better.
So guess the best is tou use java.math package claesses BigDecimal and BigInteger like described in the mentioned blog.
Hope it helps!
Regards
Patrick
As described in the blog linked in the blog above, there's a standard solution for this.
/people/thorsten.nordholmsbirk/blog/2006/08/25/new-arithmetic-and-statistical-functions-in-message-mappings-in-sp18
https://service.sap.com/sap/support/notes/958486
Regards,
Henrique.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.