Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 72043

setting the VendReceiptsListTrans.InventQty from x++

$
0
0
I have created a batch job to process a receipts list. 
My code creates the receipts list however i cannot seem to get the VendReceiptsListTrans.InventQty to update, the value is always nothing.

Is there a different way to do this?



private void postReceiptList(PurchTableContract purchTableContract) { PurchFormLetter purchFormLetter; PurchFormLetter_ReceiptsList_Extended purchFormLetter_ReceiptsList_Extended; PurchId purchId; PurchTable purchTable; PurchLine purchLine; ItemId itemId; LineNumber lineNumber; PurchQty purchQty; container lineNumberCon; Counter ctrJournalLines; int i; str responseMessage; Query query; SysQueryRun chooseLinesQuery; ListEnumerator leReceiptListLines = new ListEnumerator(); PurchLineContract purchLineContract; purchId = purchTableContract.PurchId(); purchTable = purchTable::find(purchId); if (!purchTable) { throw error(strFmt("Purchase order '%1' not found.", purchId)); } leReceiptListLines = purchTableContract.journalLines().getEnumerator(); leReceiptListLines.reset(); while (leReceiptListLines.moveNext()) { ctrJournalLines++; purchLineContract = leReceiptListLines.current(); itemId = purchLineContract.ItemId(); lineNumber = purchLineContract.LineNum(); purchQty = purchLineContract.PurchQty(); if (!itemId) { throw error("ItemId cannot be empty."); } if (!lineNumber) { throw error("lineNumber cannot be empty."); } if(purchQty == 0) { throw error(strFmt("Qty cannot be zero for item %1,
linenum %2", itemId, lineNumber)); } select forUpdate purchLine where purchLine.PurchId == purchId && purchLine.ItemId == itemId && purchLine.LineNumber == lineNumber; if (purchLine) { purchLine.PurchReceivedNow = purchQty; purchLine.update(); } else { throw error(strFmt("PurchLine not found for purchase order %1,
ItemId %2, lineNumber %3", purchId, itemId, lineNumber)); } query = new Query(queryStr(PurchUpdate)); query.dataSourceTable(tableNum(PurchTable)).addRange(fieldNum(PurchTable,PurchId)).value(queryValue(purchId));
query.dataSourceTable(tableNum(PurchLine)).addRange(fieldNum(PurchLine,lineNumber)).value(queryValue(lineNumber));
chooseLinesQuery = new SysQueryRun(query); } ttsBegin; purchFormLetter = purchFormLetter_ReceiptsList_Extended::newReceiptsListFromChooseLineQuery(chooseLinesQuery,purchTable); PurchFormLetter.parmLineList(); purchFormLetter.update(purchTable, purchId, systemDateGet(), PurchUpdate::ReceiveNow, AccountOrder::None, false, false); ttsCommit; }

Viewing all articles
Browse latest Browse all 72043

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>