Tuesday, 24 December 2013

find On Hand through X++ in ax 2009

static void findOnHand(Args _args)

InventDim inventDim;
InventDimParm inventDimParm;
Itemid itemid;
InventOnHand inventOnHand = new InventOnHand();
;

// take a sample item for testing
itemid = "20 MM RMC";

// take a combination of dimension , against which you want to find the stock
inventDim.InventLocationId = "GW";

//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()));

}

No comments:

Post a Comment