HI All,
I am using the following code to create a production Order :
ProdQty qty = 100;
ItemId item = 'XXXX';
ProdTable prodtable;
InventTable inventTable;
InventDim inventDim;
;
// Initialize InventTable
inventTable = inventTable::find(item);
// Initialize the base values
prodtable.initValue();
prodtable.initFromInventTable(inventTable);
prodtable.ItemId = inventTable.ItemId;
prodtable.DlvDate = today();
prodtable.QtySched = qty;
prodtable.RemainInventPhysical = qty;
// Initialize InventDim (Obrigatory)
inventDim.initValue();
// Set the active BOM and Route
prodtable.BOMId = BOMVersion::findActive(prodtable.ItemId,
prodtable.BOMDate,
prodtable.QtySched,
inventDim).BOMId;
prodtable.RouteId = RouteVersion::findActive(prodtable.ItemId,
prodtable.BOMDate,
prodtable.QtySched,
inventDim).RouteId;
// Initialize BOMVersion
prodtable.initBOMVersion();
// Initialize RouteVersion
prodtable.initRouteVersion();
//Use ProdTableType class to create the production order
prodtable.type().insert();
// Inform Production Order Id
setPrefix( 'Production Order');
setPrefix( 'Production Order Number');
info(prodtable.ProdId);
But the problem is in D365 FO, insert() is obselete, so i tried it with inserting() and Inserted() both, but still i am not able to create a production order sucessfully.
Can someone pls help!
Thanks i Advance