Hello Pioneers,
These days I am experiencing a strange issue in Axapta 2009. My client is producing items through
"SUBCONTRACTING", so In transfer Order, I created a field called ProdOrder reference and lookup with all production Id
generated. And placed a button "GETBOMLINES", such that, when I click on the GETBOMLINES button and select the
Production Id in header, It automatically update the Lines. I am facing a issue that, when after selecting "ProductionId" , we
click on GETBOMLINES, the system throws an error "FROM WAREHOUSE MUST BE GURGAON. For example, If I select
"DELHI" in FROM WAREHOUSE, and click on GETBOMLINES, then system throws error "FROM WAREHOUSE MUST BE
GURGAON". Likewise, If I select "HYDERABAD" in FROM WAREHOUSE, and click on GETBOMLINES, then system throws
error "FROM WAREHOUSE MUST BE HYDERABAD".
MY CODE IS :
void updateBOM()
{
ProdBOM prodBomlocal;
ProdTable prodTablelocal,prodTablelocal1;
InventTransferTable inventTransferTablelocal;
InventTransferLine inventTransferLinelocal;
InventDim inventDimlocal;
str colorid;
int i = 0;
;
ttsbegin;
while select prodBomlocal where prodBomlocal.ProdId == InventTransferTable.ProdId
{
If(prodBomlocal)
{
i = i+1;
inventTransferLinelocal.RecId =0;
inventTransferLinelocal.clear();
inventTransferLinelocal.TransferId = InventTransferTable.TransferId;
inventTransferLinelocal.ShipDate = InventTransferTable.ShipDate;
inventTransferLinelocal.ReceiveDate = InventTransferTable.ReceiveDate;
inventTransferLinelocal.ItemId = prodBomlocal.ItemId;
inventTransferLinelocal.initValue();
inventTransferLinelocal.initFromInventTable(InventTable::find(inventTransferLinelocal.ItemId));
inventTransferLinelocal.InventDimId = prodBomlocal.InventDimId;
inventTransferLinelocal.God_QuantityinKg = prodBomlocal.RemainBOMPhysical;
inventTransferLinelocal.QtyRemainShip = prodBomlocal.RemainBOMPhysical;
inventTransferLinelocal.god_UnitInPcs = prodBomlocal.UnitId;
colorid = InventDim::find(prodBomlocal.InventDimId).InventColorId;
inventTransferLinelocal.God_KgperPacking = InventColor::find(colorid,inventTransferLinelocal.ItemId).God_KgperPacking;
inventTransferLinelocal.QtyRemainReceive = inventTransferLinelocal.QtyRemainShip;
inventTransferLinelocal.god_UnitInPcs = prodBomlocal.UnitId;
inventTransferLinelocal.UnitId_IN = inventTransferLinelocal.god_UnitInPcs;
//For Cost Price STARTS
if (inventTransferLinelocal.PriceType_IN == PriceType_IN::CostPrice)
{
inventTransferLinelocal.UnitPrice_IN = inventTransferLinelocal.itemCostPrice_IN();
// inventTransferLinelocal.UnitPrice_IN = inventTransferLine_ds.itemCostPrice_IN();
}
else if (inventTransferLinelocal.PriceType_IN == PriceType_IN::TransferPrice)
{
inventTransferLinelocal.UnitPrice_IN = inventTransferLine_ds.itemTransferPrice_IN();
inventTransferLinelocal.QtyTransfer = inventTransferLine_ds.getTransferPrice_IN().Quantity;
}
inventTransferLinelocal.NetAmount_IN = inventTransferLinelocal.UnitPrice_IN * inventTransferLinelocal.QtyTransfer;
//For Cost Price ENDS
// inventTransferLinelocal.InventDimId = prodBomlocal.InventDimId;
inventTransferLinelocal.LineNum = InventTransferLine::lastLineNum(InventTransferTable.TransferId)+ 1;
inventTransferLinelocal.insert();
}
}
ttscommit;
If(i !=0)
{
select forupdate prodTablelocal where prodTablelocal.ProdId == InventTransferTable.ProdId;
{
ttsbegin;
prodTablelocal.InventTransferId_SP = InventTransferTable.TransferId;
ttscommit;
}
inventTransferLine_ds.refresh();
}
}