Monday, April 5, 2021

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

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


Check below code.

static void availTotal(Args _args)

{

    InventDim       inventDim;

    InventOnhand    inventOnhand;

    InventDimParm   inventDimParm;


    inventDim.InventSiteId = '1';

    inventDim = InventDim::findOrCreate(inventDim);



    inventDimParm.initFromInventDim(inventDim);

    inventOnhand = InventOnhand::newParameters('D0001', inventDim, inventDimParm);


    info(strFmt('%1', inventOnhand.availTotal()));

}


Keep Daxing!!

No comments:

Post a Comment