Hi,
May I know how can I calculate the physical available quantity shown on the item on hand form given the warehouse(inventLocationId)?
Thanks.
Cheers,
John
*This post is locked for comments
Try this:
InventDimParm invDimParm;
InventDim invDim;
Qty availPhys;
;
invDim.InventLocationId = 'INVENTLOCATIONID';
invDim = InventDim::findOrCreate(invDim);
invDimParm.initFromInventDim(InventDim::find(invDim.inventDimId));
availPhys = InventSum::findSum("ITEMID",invDim,invDimParm).availPhysical();
info(strfmt("availPhys:%1 ",availPhys));
There is also a class approach that works in cases where the previous example does not. For example, in the middle of a transaction where the item's onhand has already been modified (such as during a packing slip posting), the straight InventSum will return an incorrect result. The InventOnhand class takes into account uncommitted onhand changes when they exist.
InventDim inventDim;
InventDimParm inventDimParm;
InventOnhand inventOnhand;
inventDim.InventLocationId = 'Yourwarehouse';
inventDimParm.initFromInventDim(inventDim);
inventOnhand = InventOnhand::newParameters('Youritem', inventDim, inventDimParm);
info(strfmt("Available Physical: %1", inventOnhand.availPhysical()));
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Community Member 4
Guy Terry 2 Moderator
Nayyar Siddiqi 2