Thursday, April 4, 2013

Quantity on hand based on location

Q: In the Dynamics AX Application tables, InventItemLocation has wmsPickingLocation for each ItemId, and InventCountJour table has IventOnHand for each ItemId. How do you find out the amount of quantity on hand per location?

A: onHand quantity (information) should be available in the InventSum table, so go through the table and write your query. If you would like to filter the information based on a location, search for the field called “InventDim” which will tell you about the different dimensions.  Below is the code that should help you get the onHand:

static void findOnHand(Args _args)
{

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

// take a sample item for testing
itemid = "Item1";

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

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

//initialize the inventonhand with item,dimension and dim paramter

inventOnHand.parmItemId(itemid);
inventOnHand.parmInventDim(inventDim);
inventOnHand.parmInventDimParm(inventDimParm);

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

}

If you have a question about Dynamics AX that you would like answered, please email us. Or visit the BWIR website for more information about the company.

No comments:

Post a Comment