Monday, March 7, 2016

X++ Get stock on hand on an item

Refer to AX2012: X++ code to get on hand on an item Priyanka Agarwal gave an excellent clarification about getting stock on hand by given item, and dimension.

Below example shows the simple code to retrieve stock on hand on an item, without given any inventory dimensions.

    
static void Job12(Args _args)
{
    InventTable inventTable;
    ;
    
    while
    select firstOnly10 ItemId
        from inventTable
        index ItemIdx
    {
        info(inventTable.ItemId);
        info(strFmt('%1',InventOnhand::newItemId(inventTable.ItemId).availPhysical()));    
    }
}

No comments:

Post a Comment