28 April 2017

How to get on hand inventory quantity or Available physical quantity in AX 2012

public InventQty onHandInventory(ItemId itemId, InventSiteId inventSiteId,InventLocationId inventLocation)
{
    InventOnhand    inventOnhand;
    InventDim       _inventDim;
    InventDimParm   inventDimParm;
    InventQty       availQty;
    //inventDim
    _inventDim.InventSiteId = inventSiteId;
    _inventDim.InventLocationId = inventLocation;
    inventDimParm.initFromInventDim(_inventDim);

    inventOnhand = inventOnhand::newParameters(itemId,_inventDim,inventDimParm);

    availQty = inventOnhand.availPhysical();
   // info(strFmt("%1",availQty));
    return availQty;

}

Ledger Voucher creation Framework and x++ code to create ledger voucher

 Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension->...