In AX2012, Using x++ a specific sales line can be cancelled, as by using the class "SalesUpdateRemain", in below job we will see how to cancel a sales line using the class "SalesUpdateRemain" .
static void mkCancelSalesLine(Args _args) { boolean ret; SalesLine SalesLine;
try { ttsBegin; //Add your own logic to select and pass a specific sales line. SalesLine.clear(); SalesLine = SalesLine::findRecId(2137226141, true); if(SalesLine) { //pass three parameters //1.SalesLine buffer //2.remainSalesPhysical, pass it as zero as you want to cancel full line //3.remainInventPhysical, pass it as zero as you want to cancel full line ret = SalesUpdateRemain::updateDeliveryRemainder(SalesLine, 0, 0); if(ret) { info(strFmt('Sales Line # %1: Canceled',SalesLine.LineNum)); } } else { info('Sales line not found/Invalid Line'); } ttsCommit; } catch { error("Sales line got exception while attempting to be cancelled."); } }
No comments:
Post a Comment