web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Inventory adjustment journal

(0) ShareShare
ReportReport
Posted on by 575

Hi All,

Is there anyone have idea about how to create and post Inventory Adjustment Journal via x++??

Thanks&Regards

Veeramani S

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Sohaib Cheema Profile Picture
    49,438 User Group Leader on at
    static void SampleInvAdjJour_SC(Args _args)
    {
            InventJournalTable              inventJournalTable;
            InventJournalTrans              inventJournalTrans;
            InventJournalNameId             inventJournalName;
            InventDim                       inventDim;
            JournalCheckPost               journalCheckPost;
    
            //<Creation of journal header>       
            inventJournalTable.clear();
            inventJournalName =  InventJournalName::standardJournalName(InventJournalType::LossProfit);//Type LOSSPROFIT is Adjustment
            inventJournalTable.initFromInventJournalName(InventJournalName::find(inventJournalName));
            inventJournalTable.insert();
            //<end Creation of journal header>
    
            //<Creation of journal Line>
            inventJournalTrans.clear();
            inventJournalTrans.initFromInventJournalTable(inventJournalTable);
            inventJournalTrans.TransDate = systemDateGet();
            inventJournalTrans.ItemId = "D0001"; //change here item number
            inventJournalTrans.initFromInventTable(InventTable::find("D0001"));//also change here item number
            inventJournalTrans.Qty = 10;//qunatity
            inventDim.InventSiteId  = '1';
            inventDim.InventLocationId = '11';        
            //you can add here as many inventory dimensions as required
            inventJournalTrans.InventDimId = inventDim::findOrCreate(inventDim).inventDimId;
            inventJournalTrans.insert();
            //</End Creation of journal Line>
            
             //<Post Journal>
            journalCheckPost = InventJournalCheckPost::newPostJournal(inventJournalTable);
            journalCheckPost.run();
            //<End post Journal>
        
            info('Ok');
    }
  • veera seenivasan Profile Picture
    575 on at

    Thanks sohaib

  • Community Member Profile Picture
    on at

    Thank you for your code.

    I have a problem with that though.

    it says "Voucher number must be filled in"

    Would you mind telling me what is it for and how can I fill it? in our system it seems to be a sequence of numbers. Is there any way to get the next number of the sequence?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans