web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

Get on hand inventory (quantity) of an item using x++

Moeen Ahmed Sultan Profile Picture Moeen Ahmed Sultan 1,402

To get on hand inventory (quantity) of an item using x++ in Microsoft Dynamics 365 for Finance and Operations or in Microsoft Dynamics AX 2012 is always a headache because there is no field in the table which gives the on hand inventory. So, to tackle this issue I am sharing this function. It gets two arguments which are as follows:

  1. ItemId
  2. InventDimId

It returns on hand inventory.

public InventQtyAvailPhysical onHandInventory(ItemId _itemId, InventDimId _inventDimId)
{
    InventOnhand    inventOnhand;
    InventDim       inventDim = inventDim::find(_inventDimId);
    InventDimParm   inventDimParm;

    inventDimParm.initFromInventDim(inventDim);
    inventOnhand = InventOnhand::newParameters(_itemId, inventDim, inventDimParm);
    return inventOnhand.availPhysical();
}

So, this is how you can get on hand inventory (quantity) of an item using x++ in D365FO or in AX 2012. Moreover, you can also explore more functions and tricks. Don’t forget to share your code in comments.

If this helps you, please Like, Comment and Share to help other people.

Blog: Click here

YouTube: Click here

GitHub: Click here

A pessimist sees the difficulty in every opportunity; an optimist sees the opportunity in every difficulty. – Winston Churchill

The post Get on hand inventory (quantity) of an item using x++ appeared first on NevoiTech Blog.

Comments

*This post is locked for comments