Create Inventory External Journal Through x++
Here is the code for creating External journal in Dynamics Ax
static void CreateInventExternalJournal(Args _args)
static void CreateInventExternalJournal(Args _args)
{
InventJournalTable inventJournalTable;
InventJournalTrans inventJournalTrans;
InventJournalName inventJournalName;
InventDim inventDim;
JournalCheckPost journalCheckPost;
//Below code creates journal header
inventJournalTable.clear();
inventJournalName = InventJournalName::standardJournalName(InventJournalType::Movement);
inventJournalTable.initFromInventJournalName(InventJournalName::find(inventJournalName ));
inventJournalTable.insert();
//Below code creates journal lines
inventJournalTrans.clear();
inventJournalTrans.initFromInventJournalTable(inventJournalTable);
inventJournalTrans.TransDate = systemDateGet();
inventJournalTrans.ItemId = "000004";
inventJournalTrans.Qty = 100;
inventDim.InventSiteId = '12';
inventDim.InventLocationId = '1201';
inventDim.wMSLocationId = 'BULK-001';
inventJournalTrans.InventDimId = inventDim::findOrCreate(inventDim).inventDimId;
inventJournalTrans.insert();
//The below code posts the journal
journalCheckPost = InventJournalCheckPost::newPostJournal(inventJournalTable);
journalCheckPost.run();
}
now run the job
now run the job
No comments:
Post a Comment