Using x++ a specific sales line can be canceled, as demonstrated, in below job. The code is simple to understand, as you will go through job.
static void sampleCancelSOLine(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(5637326141, 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 canceled."); } }
*This post is locked for comments