How to find the item has batch id setup or not?

Hi All,

I have to create new batch id and assign that newly created batch id to the item when i create a packing slip.

The item will be in purchparamline table.

I am not sure, how to find the selected item has configured for batchid or not.

Please help me to find the particular item id has configured for batch number or not

Thanks in advance,

Hari

if (InventDimGroupSetup::newItemId(‘yourItem’).isDimensionActive(fieldNum(InventDim,InventBatchId)))

{

info(‘Batch Enabled’);

}

Hi Kranthi,

Thanks for your reply. Your method is working fine. There is one more one method in inventtable that method name "‘isItemBatchActivated’. This method is also working fine.

Thanks again for your support.

Hari

Hi Kranthi,

I am having a problem in importing items from excel. After assigning values for reqitemtable, when i try to validate, i get this error message “Storage and/or tracking dimension groups have not been specified for item 9609Ax. Click the Dimension groups button in the Released products details form to complete the setup.” Can you please take a look and help me out.

Successfully inventdimension and tracking/storage dimensions are created attaching the same code for your reference.

Thanks,

salman

I am attaching the code with parenthesis the point where i am getting error.

reqItemTable.clear();

reqItemTable.initValue();

reqItemTable.initFromInventTable(inventTable::find(_itemId));

reqItemTable.ItemId = _itemId;

reqItemTable.covRule = reqcovtype::Period;

reqItemTable.CovPeriod = 1;

reqItemTable.MinInventOnhand = _InventMax;

reqItemTable.MaxInventOnhand = _InventMin;

reqItemTable.reqGroupId = _reqGrpId2;

reqItemTable.LeadTimePurchase = _PurchTime;

reqItemTable.LeadTimePurchaseActive = _PurchTime > 0 ? NoYes::Yes : NoYes::No;

reqItemTable.CalendarDaysPurchase = _PurchCalDays;

reqItemTable.LeadTimeProduction = _ProdTime;

reqItemTable.LeadTimeProductionActive = _ProdTime > 0 ? NoYes::Yes : NoYes::No;

reqItemTable.CalendarDaysProduction = _ProdCalDays;

reqItemTable.LeadTimeTransfer = _TransTime;

reqItemTable.LeadTimeTransferActive = _TransTime > 0 ? NoYes::Yes : NoYes::No;

reqItemTable.CalendarDaysTransfer = _TransCalDays;

reqItemTable.CovInventDimId = inventDim.inventDimId;

if (reqItemTable.validateWrite()) <—this is where i am getting error

{

reqItemTable.insert();

}

else

{

_recInsertFailed = true;

ttsAbort;

return true;

}

inventDim.clear();

InventDimToFind.clear();

inventDim.initValue();

inventDim.initFromInventTable(inventTable::find(_itemId));

InventDimToFind.inventLocationId = _warehouseId; // fill the buffer in memory

inventDimtmp = InventDim::findOrCreate(inventDimToFind);

inventDim.InventLocationId = _warehouseId;

inventDim.inventDimId = inventDimtmp.inventDimId;

if (inventDim.validateWrite())

{

inventDim.insert();

}

else

{

_recInsertFailed = true;

ttsAbort;

return true;

}

ecoResStorageDimensionGroupProduct.clear();

ecoResStorageDimensionGroupProduct.initValue();

ecoResStorageDimensionGroupProduct.Product = ecoResDistinctProduct.RecId;

ecoResStorageDimensionGroupProduct.StorageDimensionGroup = EcoResStorageDimensionGroup::findByDimensionGroupName(_inventItemStgDimGrp).RecId;

if (ecoResStorageDimensionGroupProduct.validateWrite())

{

ecoResStorageDimensionGroupProduct.insert();

}

else

{

_recInsertFailed = true;

ttsAbort;

return true;

}

//Tracking dimension group

ecoResTrackingDimensionGroupProduct.clear();

ecoResTrackingDimensionGroupProduct.initValue();

ecoResTrackingDimensionGroupProduct.Product = ecoResDistinctProduct.RecId;

ecoResTrackingDimensionGroupProduct.TrackingDimensionGroup = EcoResTrackingDimensionGroup::findByDimensionGroupName(_inventItemTrkDimGrp).RecId;

if (ecoResTrackingDimensionGroupProduct.validateWrite())

{

ecoResTrackingDimensionGroupProduct.insert();

}

else

{

_recInsertFailed = true;

ttsAbort;

return true;

}