Sunday, June 28, 2015

ERROR IN INVENTORY RECALCULATION "Account Number for transaction type Inventory, inventory receipt does not exist" - Ax 2012

Hello Guys..!

While doing inventory closing got below error

 "Account Number for transaction type Inventory, inventory receipt does not exist"


Reason :

I have given all accounts in posting profiles , but still same problem. Finally I found that offset ledger dimension value is missing in "InventTransPosting" table.

Solution :

By updating offset ledger dimension value in InventTransPosting Table.

Copy and Paste below code in AOT->Jobs and then run the job.

Note : Change from and todate in the below job according to your requirement

Example : If you are doing inventory closing from 1 JAN 2015 to 28 Feb 2015 .
                 Give same dates in below job.


static void UpdateInventTransPosting(Args _args)
{
    InventTransPosting                      inventTransPosting;
    GeneralJournalEntry                     generalJournalEntry;
    GeneralJournalAccountEntry              generalJournalAccountEntry;
    SubledgerVoucherGeneralJournalEntry     subledgerVoucherGeneralJournalEntry;
    TransDate                               frmDt = mkDate(04,05,2015);// Need to change
    TransDate                               toDt = mkDate(15,05,2015);// Need to change
    ;
    startLengthyOperation();
    ttsBegin;
    while select inventTransPosting where inventTransPosting.TransDate <= frmDt && inventTransPosting.TransDate >= toDt
        && inventTransPosting.OffsetLedgerDimension
        && inventTransPosting.InventTransPostingType == InventTransPostingType::Financial
    {
        select LedgerDimension from generalJournalAccountEntry
        join RecId from generalJournalEntry
        where generalJournalEntry.RecId == generalJournalAccountEntry.GeneralJournalEntry
        && (generalJournalAccountEntry.PostingType == LedgerPostingType::InventLoss || generalJournalAccountEntry.PostingType == LedgerPostingType::InventProfit)
        join RecId from subledgerVoucherGeneralJournalEntry
        where subledgerVoucherGeneralJournalEntry.GeneralJournalEntry == generalJournalEntry.RecId
        && subledgerVoucherGeneralJournalEntry.Voucher == inventTransPosting.Voucher
        && subledgerVoucherGeneralJournalEntry.VoucherDataAreaId == inventTransPosting.dataAreaId
        && subledgerVoucherGeneralJournalEntry.AccountingDate == inventTransPosting.TransDate;
       if (generalJournalAccountEntry.LedgerDimension)
        {
            inventTransPosting.selectForUpdate(true);
            inventTransPosting.OffsetLedgerDimension = generalJournalAccountEntry.LedgerDimension;
            inventTransPosting.doUpdate();
        }
    }
    ttsCommit;
    info('Updation completed');
    endLengthyOperation();
}


That's It...!


@Rahul Talasila

1 comment:

  1. And if i received error like this then "Account number for transaction type Inventory profit does not exist."

    ReplyDelete

Why do users often get confused about Dynamics 365 Customer Engagement (D365 CE), Dataverse, and the Power Platform?

  The Microsoft ecosystem for business applications can sometimes be difficult to navigate, especially when discussing Dynamics 365 Customer...