Hi,
I'm trying to create production order through code but it giving an error of "Inventory dimension Site is mandatory and must consequently be specified." even I've set the site and location.
Below is the code
ProdTable prodtable;
InventTable inventTable;
InventDim inventDim,inventDimlocal;
InventItemOrderSetupType setupType = InventItemOrderSetupType::Invent;
;
inventTable = inventTable::find(_selectedLines.ItemNumber);
prodtable.initValue();
prodtable.initFromInventTable(inventTable);
prodtable.ItemId = inventTable.ItemId;
prodtable.DlvDate = _selectedLines.RequestDate;
prodtable.QtySched = _selectedLines.Quantity;
prodtable.RemainInventPhysical = _selectedLines.Quantity;
inventDim.initValue();
inventDim.InventSiteId = '1';
// Default Location
inventDim.InventLocationId = '11';
inventDim.ConfigId = inventTable.StandardConfigId;
inventDimlocal = InventDim::findOrCreate(inventDim);
prodtable.BOMId = BOMVersion::findActive(prodtable.ItemId,
prodtable.BOMDate,
prodtable.QtySched,
inventDimlocal).BOMId;
prodtable.RouteId = RouteVersion::findActive(prodtable.ItemId,
prodtable.BOMDate,
prodtable.QtySched,
inventDimlocal).RouteId;
prodtable.initBOMVersion();
prodtable.initRouteVersion();
ttsbegin;
prodtable.insert();
ttscommit;

Report
All responses (
Answers (