Sunday, 28 June 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

No comments:

Post a Comment

Document type to keep attachments of ER configurations has not been defined in ER parameters dynamics 365 finance & Operations

I was getting the below error while generating electronic payment for vendor payments in d365 F&O with 8.0 version. Document type to ...