Home computer programming, dynamics ax ax2012-You can’t have unallocated cost on a planning item
computer programmingdynamics ax

ax2012-You can’t have unallocated cost on a planning item

this is an old article that I posted on wordpress you can visit the old article here

20161018-1332

while Im doing inventory calculation

Im searching on net, why it would happen, it happens because The error always occurs when it is trying to pass an adjustment through a production order (“Batch order”).  Every other month we encounter this issue so we customized it to tell us the production order number

for reference by dynamics ax trix: click here, but it only solved on ax 2009, not on ax 2012

so i need to figure other alternative solution about this case because I am using ax 2012 (note: the solution may different by any case)

and my solution is:

  1. check if the item in production type is formula or not, if not, change it to formula
  2. open code \Classes\InventCostItemDim.addFormulaKeyAdjustment()
  3. see line containing “throw error(“@PRO997″);”
  4. this error happens while it has difference adjustment and amount that allocate because of rounding
  5. the solution key is in 2 classes that must be modified just like the picture below:

20161018-1334

20161018-1335

 

after the code change, i do resume calculation, and this is what happened.

20161018-1337

20161018-1338

 

Conclusion : the problem is because rounding problem, decround, putting syntax decround in x++ on wrong line can cause alot of problem,

but be careful, what I did is changing source in sys and fpp layer, please ask your consultant before changing this layer

please have a comment

Author

Ronny

Join the Conversation

  1. Can you please send me the entire code change, the screen shot doesn’t cover the full code.
    Also noticed the method is different than what I have in my environment did you install any KB as well for the extra lines (I am using the same environment i.e. AX 2012 R3).
    Will be great if you can send me the xpo copies or X++ codes for the same.

  2. Hi Metthu,

    the solution are in
    1. classes\inventcostitemdim\addformulakeyadjustment
    – the point is we must convert adjAmt into Currency type amount
    2. classes\ledgervouchertransobject\checkrounding
    – the point is making validation by rounding down because the ax only have 2 digit for currency rounding

    Im using ax 2012 FP, CU 6 no installed any KB,

    this is source of checkrounding function

    /// 
    ///    Validates that the transaction amounts are properly rounded.
    /// 
    /// 
    ///    true if the amounts are properly rounded; otherwise, false.
    /// 
    /// 
    ///    The transaction amounts are validated based on to the rounding rules for the specified currency.
    /// 
    private boolean checkRounding()
    {
        AmountMST roundedAmount;
        CurrencyCode accountingCurrency;
    
        accountingCurrency = CompanyInfo::standardCurrency();
    
        roundedAmount = CurrencyExchangeHelper::round(generalJournalAccountEntry.AccountingCurrencyAmount, accountingCurrency);
    
        if (generalJournalAccountEntry.AccountingCurrencyAmount != roundedAmount)
        {
            error(strfmt(
                "@SYS27168",
                accountingCurrency,
                Currency::roundingPrecisionAdjusted(accountingCurrency)));
    
            // the message includes "penny rounding threshhold" which seems wrong
            // The unit of %1 %2 being posted to account %3 is outside the current penny rounding threshold.
            return checkFailed(strfmt(
                "@SYS18429",
                num2str(generalJournalAccountEntry.AccountingCurrencyAmount, 0, 16, -1, -1),
                accountingCurrency,
                DimensionAttributeValueCombination::getDisplayValue(generalJournalAccountEntry.LedgerDimension)));
        }
    
        if (generalJournalAccountEntry.TransactionCurrencyCode != '')
        {
            roundedAmount =
                CurrencyExchangeHelper::round(generalJournalAccountEntry.TransactionCurrencyAmount, generalJournalAccountEntry.TransactionCurrencyCode);
    
            //if (round(generalJournalAccountEntry.TransactionCurrencyAmount,0.01) != roundedAmount)     //modif by eel 18 maret 2014
            if (decRound(generalJournalAccountEntry.TransactionCurrencyAmount,2) != roundedAmount)     //modif by RF 2016 10 18
            {
                error(strfmt(
                    "@SYS27168",
                    generalJournalAccountEntry.TransactionCurrencyCode,
                    Currency::roundingPrecisionAdjusted(generalJournalAccountEntry.TransactionCurrencyCode)));
    
                return checkFailed(strfmt(
                    "@SYS18429",
                    num2str(generalJournalAccountEntry.TransactionCurrencyAmount, 0, 16, -1, -1),
                    generalJournalAccountEntry.TransactionCurrencyCode,
                    DimensionAttributeValueCombination::getDisplayValue(generalJournalAccountEntry.LedgerDimension)));
            }
        }
    
        return true;
    }
    
    

Leave a Reply