Thursday, May 15, 2014

Get Inventory Dimension From ItemID ... Site,warehouse,Config,Dimid

// Get Inventory Dimension From ItemID ... Site,warehouse,Config,Dimid

static void GetInventoryDimensions(Args _args)
{
    InventTable                 inventTable = inventTable::find('1005');
    InventItemOrderSetupType    setupType   = InventItemOrderSetupType::Invent;
    InventDim                   inventDim;
    ;

    inventDim.InventSiteId = inventTable.inventItemOrderSetupMap(setupType).inventSiteId(inventDim.InventSiteId, inventTable);
    inventDim.InventLocationId  = inventTable.inventItemOrderSetupMap(setupType,
                                                                      InventDim::findOrCreate(inventDim).InventDimId)
                                                                      .inventLocationId(inventDim.InventLocationId,
                                                                                        inventTable,
                                                                                        inventDim.InventSiteId);

    inventDim.ConfigId = inventTable.StandardConfigId;
    inventDim = InventDim::findOrCreate(inventDim);

    info(strFmt('Invent Dim. Id: %1', inventDim.inventDimId));
    info(strFmt('Site Id: %1', inventDim.InventSiteId));
    info(strFmt('Warehouse Id: %1', inventDim.InventLocationId));
}

No comments:

Post a Comment

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...