Tuesday, July 23, 2019

Get OnHand Stock value using Warehouse, Date and ItemId using X++

 public real GetOnHandStock(InventLocationId _warehouse,TransDate _transDate,Itemid _itemid)
    {
        InventDim                   inventDim;
        InventDimParm               inventDimParm;
        InventLocation              inventLocation;
        InventSumDatePhysicalDim    inventSumDatePhysicalDim;
        real                        OnhandQty;
        inventLocation              = InventLocation::find(_warehouse);
        inventDim.wMSLocationId     =inventLocation.WMSLocationIdDefaultReceipt;
        inventDim.InventLocationId  = inventLocation.InventLocationId;
        inventDim.InventSiteId      =inventLocation.InventSiteId;
        inventDim                   = InventDim::findOrCreate(inventDim);
        inventDimParm.initFromInventDim(inventDim);
        OnhandQty                    =    InventSumDatePhysicalDim::onHandQty(_transDate,_itemid,inventDim,inventDimParm);
        return OnhandQty;
    }

No comments:

Post a Comment

Get Enum Id and Enum Value in D365FO using SQL and X++

 Below is the sql get enum id and enum value of a enum in D365 F&O using sql. SELECT   enumidtable . NAME           'Enum Name' ...