I have a method for a display field which does the following;
return InventSum::find(_salesLine.ItemId, InventDim::_salesLine.InventDimId).AvailPhysical();
This gives me the on-hand Available Physical for the line site/warehouse/location.
I need to see the total available for just the site/warehouse. I think I need to search inventDim by Item/Warehouse to get my inventdimid, but I cannot find the method so I am suspicious that this is incorrect.
Can anyone help?
My working solution...
InventDimParm invDimParm;
InventDim warehouseInvDim;
InventDim salesLineInventDim;
;
salesLineInventDim = _salesLine.inventDim();
warehouseInvDim.InventSiteId = salesLineInventDim.InventSiteId;
warehouseInvDim.InventLocationId = salesLineInventDim.InventLocationId;
warehouseInvDim = InventDim::findOrCreate(warehouseInvDim);
invDimParm.initFromInventDim(InventDim::find(warehouseInvDim.inventDimId));
return InventSum::findSum(_salesLine.ItemId,warehouseInvDim,invDimParm).availOrdered();
I know this is for availOrdered() but it works exactly the same for availPhysical()
You should use the InventOnhand
class.
It sums the invent on-hand values based on criteria like item id and inventory dimensions.
There are lots of uses in AX, search the Class node.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With