AX2012 R2 : X++ code to create and post Inventory Movement Journal
InventJournalTable inventJournalTable;
InventJournalTrans inventJournalTrans;
InventJournalTrans
InventJournalName inventJournalName;
InventDim inventDim;
JournalCheckPost journalCheckPost;
//Below code creates journal header
InventDim
JournalCheckPost
//Below code creates journal header
inventJournalTable.clear();
inventJournalName = InventJournalName::standardJournalName( InventJournalType::Movement);
inventJournalTable. initFromInventJournalName( InventJournalName::find(inventJournalName )) ;
inventJournalTable.
inventJournalTable.insert();
//Below code creates journal lines
inventJournalTrans.clear();
inventJournalTrans. initFromInventJournalTable( inventJournalTable);
inventJournalTrans.TransDate = systemDateGet();
inventJournalTrans.ItemId = "MDJ0001";
inventJournalTrans.Qty = 2500;
inventDim.InventSiteId = '12';
inventDim.InventLocationId = '1201';
inventDim.wMSLocationId = 'BULK-001';
inventJournalTrans.InventDimId = inventDim::findOrCreate( inventDim).inventDimId;
inventJournalTrans.
inventJournalTrans.TransDate = systemDateGet();
inventJournalTrans.ItemId = "MDJ0001";
inventJournalTrans.Qty = 2500;
inventDim.InventSiteId = '12';
inventDim.InventLocationId = '1201';
inventDim.wMSLocationId = 'BULK-001';
inventJournalTrans.InventDimId = inventDim::findOrCreate(
inventJournalTrans.insert();
//The below code posts the journal
journalCheckPost = InventJournalCheckPost::newPostJournal(inventJournalTable);
journalCheckPost.run();
0 comments:
Post a Comment