Skip to main content

Posts

Showing posts with the label itemid

Insert Records in Item batch Table by code in Ax 2012

To Insert Records in Item batch Table by code in Ax 2012 you can take hints from below code. First, you need to check whether a record exists or not in the inventbatch table if it does not exist then you can insert records. if (InventBatch::exist(Itemid,Inventbatchid)) { //error("Batchnumber already exists"); } else { inventBatch.itemId=Itemid; inventBatch.inventBatchId=Inventbatchid; inventBatch.prodDate=mkDate(1,12,2017);//systemDateGet(); inventBatch.insert(); }

How to find BOM Unit and Inventory Unit for item in Ax 2012

To find BOM Unit and Inventory Unit for item you can get idea from below code sample.This code you can try in your job code editor in axapta. InventTable inventTable; InventUnitId inventoryUnit,BOMUnit; BOM bom; ItemId curItem; ; while select BOM order by itemid where BOM.BOMQty { if(curItem != BOM.ItemId) { curItem = BOM.ItemId; inventTable = InventTable::find(bom.ItemId); inventoryUnit = inventTable.InventUnitId(); BOMUnit = bom.UnitId; if(!UnitOfMeasureConverter::canBeConverted(UnitOfMeasure::findBySymbol(inventoryUnit).RecId, UnitOfMeasure::findBySymbol(BOMUnit).RecId, inventTable.Product)) { if(inventoryUnit != BOMUnit) { info(strFmt("item %1 has bom unit %2, inventory unit %3",inventTable.itemId,BOMUnit,inventoryUnit)); } } }

Question and answer on Inventory in Axapta 2009

1. Is the InventDimParm table a temporary table? ANSWER: Yes 2. In which method is an InventDim record created? ANSWER: InventDim::FindOrCreate() 3. Which class is used to create inventory transactions? ANSWER: InventUpdate 4. Why has the Inventory Multi-transaction Tracking system been introduced? ANSWER: To solve deadlocking in InventSum 5. True or false: An InventDimId is always unique to an itemId. ANSWER: False

example of queryrun in MSD axapta

example of queryrun in axapta SysQueryRun queryRun = new SysQueryRun(querystr(MyQuery)); CustInvoiceJour custInvoiceJour; CustInvoiceTrans custInvoiceTrans; ; if (queryRun.prompt()) { while (queryRun.next()) { custInvoiceJour = queryRun.get(tableNum(CustInvoiceJour)); custInvoiceTrans = queryRun.get(tableNum(CustInvoiceTrans)); if (queryRun.changed(tableNum(CustInvoiceJour))) { info(strfmt("Account: %1", custInvoiceJour.invoiceAccount)); } if (queryRun.changed(tableNum(CustInvoiceTrans))) { info(strfmt("Item: %1, Qty: %2, ",custInvoiceTrans.itemId, custInvoiceTrans.qty)); } } }