static void findOnHand(Args _args)
{
InventDim inventDim;
InventDimParm inventDimParm;
Itemid itemid;
InventOnHand inventOnHand = new InventOnHand();
;

// take a sample item for testing
itemid = “1000”;

// take a combination of dimension , against which you want to find the stock

inventDim.InventSiteId = “1”;
inventDim.InventLocationId = “11”;

//Set the flag for the selected dimensions as active.
inventDimParm.initFromInventDim(inventDim);

//initialize the inventonhand with item,dimension and dim paramter
inventOnHand = InventOnHand::newParameters(itemid, inventDim, inventDimParm);

// Retrieve the onhand info
info(strfmt(“Available Physical: %1”, inventOnhand.availPhysical()));
info(strfmt(“Physical Invent: %1”, inventOnhand.physicalInvent()));
info(strfmt(“On order: %1”, inventOnhand.onOrder()));

}