on hand qty
static void OnHandQty(Args _args)
{
InventDim inventDim;
InventSum inventSum;
InventOnhand inventOnHand;
InventDimParm inventDimParm;
ItemId itemId;
InventQty availQty;
InventQty inventQty;
while select sum(postedQty), sum(received), sum(deducted), sum(registered),
sum(picked), sum(reservPhysical)
from InventSum group by itemId
join InventDim
where inventSum.inventDimId == inventDim.inventDimId &&
inventSum.itemId == 'B' &&
inventDim.inventLocationId == 'Mumbai'
{
inventQty = inventSum.PostedQty+inventSum.Received+inventSum.Deducted-
inventSum.Picked-inventSum.ReservPhysical;
}
info(strfmt('%1', inventQty));
itemId = 'BA1502926-P-WH15766-01';
inventDim.InventLocationId = 'Mumbai';
inventDimParm.initFromInventDim(inventDim);
inventOnHand = inventOnHand::newParameters(itemId,inventDim,inventDimParm);
availQty = inventOnHand.availPhysical();
info(strfmt('%1', availQty));
}
static void OnHandQty(Args _args)
{
InventDim inventDim;
InventSum inventSum;
InventOnhand inventOnHand;
InventDimParm inventDimParm;
ItemId itemId;
InventQty availQty;
InventQty inventQty;
while select sum(postedQty), sum(received), sum(deducted), sum(registered),
sum(picked), sum(reservPhysical)
from InventSum group by itemId
join InventDim
where inventSum.inventDimId == inventDim.inventDimId &&
inventSum.itemId == 'B' &&
inventDim.inventLocationId == 'Mumbai'
{
inventQty = inventSum.PostedQty+inventSum.Received+inventSum.Deducted-
inventSum.Picked-inventSum.ReservPhysical;
}
info(strfmt('%1', inventQty));
itemId = 'BA1502926-P-WH15766-01';
inventDim.InventLocationId = 'Mumbai';
inventDimParm.initFromInventDim(inventDim);
inventOnHand = inventOnHand::newParameters(itemId,inventDim,inventDimParm);
availQty = inventOnHand.availPhysical();
info(strfmt('%1', availQty));
}
This comment has been removed by the author.
ReplyDeleteA better way and small code to get On hand inventory:
ReplyDeletehttp://msdynamics.nevoitech.com/microsoft/get-on-hand-inventory-quantity-of-an-item-using-x/