D365FFO – AX – X++ – InventOnHand Vs InventDimOnHand

What the difference between InventOnHand and InventDimOnHand classes and in what cases they must be used?

Axapta InventOnHand class is wrapper for InventSum table. Unique index for InventSum table is ItemId + InventDimId. In other word, this class is used to get on hand for item with specific dimension. For example, if you require getting on-hand qty for “Bottle” items that have “green” color, “standard” size and are stored in “22” warehouse, “1” Aisle, “4” Shelf then you use InventOnHand class.

But, if you require getting on-hand qty for warehouse location then InventOnHand class couldn’t help us. Because one location could contains different items. Or if you require get on-hand qty for pallet. In these cases InventDimOnHand class must be used. This class is used when you require on-hand qty for specific inventDim. InventDimOnHand сlass consists of InventDimOnHandMember classes. Each InventDimOnHandMember class contains information about Item, Dimensions and Qty.

Example: “Get location on-hand”

static void rmsOnHandQty(Args _args)
WMSLocation wmsLocation;
InventDim inventDimLocal;
InventDimParm inventDimParmCriteria;
InventDimOnHand inventDimOnHand;
InventDimOnHandIterator inventDimOnHandIterator;
InventDimOnHandMember inventDimOnHandMember;
Qty qty;

select firstonly wmsLocation;

inventDimLocal.InventLocationId = wmsLocation.inventLocationId;
inventDimLocal.wMSLocationId = wmsLocation.wMSLocationId;
inventDimLocal = InventDim::findOrCreate(inventDimLocal);

inventDimParmCriteria.wmsLocationIdFlag = NoYes::Yes;
inventDimParmCriteria.InventLocationIdFlag = NoYes::Yes;

inventDimOnHand = InventDimOnHand::newPhysicalArrived(”, inventDimLocal, inventDimParmCriteria, inventDimOnHandLevel::Item, null);
inventDimOnHandIterator = inventDimOnHand.onHandIterator();
while (inventDimOnHandIterator.more())
inventDimOnHandMember = inventDimOnHandIterator.value();
qty += inventDimOnHandMember.parmInventQty();

info(strfmt("%1 location has %2 items", wmsLocation.wMSLocationId, num2str(qty,2,2,1,1)));


Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo di WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione /  Modifica )

Google photo

Stai commentando usando il tuo account Google. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )

Connessione a %s...