D365/AX7: Inventory Registration & Un-Registration Using X++ Class InventTransWMS_register

Hey Visitors,

Here is the sample code for Inventory Registration & Un-Registration Using X++ Class InventTransWMS_register.

cheers,

piyush adhikari – +91-7995802472

public static void operations(PurchId _purchId)
{
PurchLine purchLine;
InventTrans inventTrans;
InventDim inventDim;
InventTransWMS_Register inventTransWMS_register;
TmpInventTransWMS tmpInventTransWMS;
;

ttsbegin;
while select RecId, InventTransId from purchLine
where purchLine.PurchId == _purchId
&& purchLine.IsDeleted == NoYes::No
&& purchLine.PurchQty > 0
{
inventTrans = InventTrans::findTransId(purchLine.InventTransId);
if(inventTrans && inventTrans.StatusReceipt != StatusReceipt::Registered)
{
inventDim = inventTrans.inventDim();
tmpInventTransWMS.clear();
tmpInventTransWMS.initFromInventTrans(inventTrans);
tmpInventTransWMS.InventQty = inventTrans.Qty;
tmpInventTransWMS.InventDimId = inventDim.inventDimId;
tmpInventTransWMS.insert();

inventTransWMS_register = inventTransWMS_register::newStandard(tmpInventTransWMS);
inventTransWMS_Register.createFromInventTrans(inventTrans, inventDim);
inventTransWMS_register.writeTmpInventTransWMS(tmpInventTransWMS, inventTrans, inventDim);
inventTransWMS_register.updateInvent(inventTrans);
}
}
ttscommit;
}



Leave a Reply