Here we will see how to find the Stock on hand of a Item using the X++ code.
Key things to know:
1. The stock on hand will vary depending on Inventory dimensions.
2. The standard Class "InventOnhand" will have all the methods to find out the different formats of stock.
3. Job:
static void MK_stockOnHand(Args _args)
{
InventOnhand inventOnHand;
InventDim inventDim;
InventDimParm inventDimParm;
InventQty stockOnHand;
ItemId itemid = "00001aTestInter";
inventDim.InventSiteId = "VIC"; // site
inventDim.InventLocationId = "SOM"; // warehouse
// inventDim.InventLocationId = "RES";
inventDimParm.initFromInventDim(inventDim);
inventOnHand = InventOnhand::newParameters(itemid,inventDim,inventDimParm);
stockOnHand = inventOnHand.availPhysical();
info (strFmt(" Stock on Hand for Item %1 is %2",itemid,stockOnHand));
}
Happy learning...Mallik
Key things to know:
1. The stock on hand will vary depending on Inventory dimensions.
2. The standard Class "InventOnhand" will have all the methods to find out the different formats of stock.
3. Job:
static void MK_stockOnHand(Args _args)
{
InventOnhand inventOnHand;
InventDim inventDim;
InventDimParm inventDimParm;
InventQty stockOnHand;
ItemId itemid = "00001aTestInter";
inventDim.InventSiteId = "VIC"; // site
inventDim.InventLocationId = "SOM"; // warehouse
// inventDim.InventLocationId = "RES";
inventDimParm.initFromInventDim(inventDim);
inventOnHand = InventOnhand::newParameters(itemid,inventDim,inventDimParm);
stockOnHand = inventOnHand.availPhysical();
info (strFmt(" Stock on Hand for Item %1 is %2",itemid,stockOnHand));
}
Happy learning...Mallik
No comments:
Post a Comment