Find InventOnHand in axapta x++

Hi, you guys!

Four days to new year and counting!

Today, I want to share you a function to get InventOnHand by ItemId and InventLocationId.


InventOnHand findOnHandByLocationId(ItemId _itemId, InventLocationId _inventLocationId)
{
    InventDim           inventDim;
    InventDimParm       inventDimParm;
    InventOnHand        inventOnHand = new InventOnHand();
    ;

    //Take a combination of dimension , against which you want to find the stock
    inventDim.InventLocationId  = _inventLocationId;

    //Set the flag for the selected dimensions as active
    inventDimParm.initFromInventDim(inventDim);

    //Initialize the inventSumDateDim with Date,item,dimension and dim parameter
    inventOnHand = InventOnHand::newParameters(_itemid,
                                               inventDim,
                                               inventDimParm);

    return inventOnHand;
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.