[Error] - Error in unit of amount in currency KES. Must be rounded to 0.01 | The unit of 37.563.5343100000000000 KES being posted to account 32710001-- is outside the current penny rounding threshold | Posting has been canceled
Hi Readers,
Today, in this article we will share a very known issue of AX, most of the people are still struggling to find out the solution for the below error.
We got this error when we were posting Ledger Journal using X++. One of the developers find out the solution for the below error so we are posting the solution here.
Error:
Error in unit of amount in currency KES. Must be rounded to 0.01.
The unit of 37.563.5343100000000000 KES being posted to account 32710001-- is outside the current penny rounding threshold.
Posting has been canceled.
Solution:
1. Check in your code, how you are inserting Amount for Credit and Debit for Ledger Journal posting.
2. Make Amount field value till two decimals use roundDownDec method.
3. Please see the below code, we have written a AX Job to illustrate.
5. Make the changes in your code according to our solution.
6. Please don't forget to run incremental CIL if you are running this code in batch job.
Comment below if this solution works for you and share this article with your colleague to help them.
Author:
Chirag Gupta
Microsoft Dynamics 365 AX Technical Consultant at IBM Bangalore
Date:
17-Sep-2019
Happy Learning !!
Today, in this article we will share a very known issue of AX, most of the people are still struggling to find out the solution for the below error.
We got this error when we were posting Ledger Journal using X++. One of the developers find out the solution for the below error so we are posting the solution here.
Error:
Error in unit of amount in currency KES. Must be rounded to 0.01.
The unit of 37.563.5343100000000000 KES being posted to account 32710001-- is outside the current penny rounding threshold.
Posting has been canceled.
Solution:
1. Check in your code, how you are inserting Amount for Credit and Debit for Ledger Journal posting.
2. Make Amount field value till two decimals use roundDownDec method.
3. Please see the below code, we have written a AX Job to illustrate.
// Code written by Chirag Gupta
server static void roundDownDecExample(Args _args)
{
real r = 37563.5343100000000000;
real a;
a = roundDownDec(r, 2);
r = a;
info(strFmt("%1", r));
}
4. You will get the output of the above AX Job like: 37563.53server static void roundDownDecExample(Args _args)
{
real r = 37563.5343100000000000;
real a;
a = roundDownDec(r, 2);
r = a;
info(strFmt("%1", r));
}
5. Make the changes in your code according to our solution.
6. Please don't forget to run incremental CIL if you are running this code in batch job.
Comment below if this solution works for you and share this article with your colleague to help them.
Author:
Chirag Gupta
Microsoft Dynamics 365 AX Technical Consultant at IBM Bangalore
Date:
17-Sep-2019
Happy Learning !!
Comments
Post a Comment