我想以编程方式取消AX2009中状态为BackOrder且小于特定日期的所有SalesOrders。
答案 0 :(得分:2)
我设法通过运行以下作业
来完成此操作static void SalesOrderUpdate(Args _args)
{
SalesTable salesTable;
SalesLine salesLine;
int i;
;
changecompany ('10')
{
ttsBegin;
while select forUpdate salesTable
where salesTable.SalesStatus == SalesStatus::Backorder
&& salesTable.ReceiptDateRequested <= 31\12\2016
&& salesTable.ShippingDateRequested <= 31\12\2016
join forUpdate salesLine
where salesLine.SalesId == salesTable.SalesId
{
i++;
salesLine.RemainSalesPhysical = 0;
salesLine.RemainInventPhysical = 0;
salesLine.update();
}
ttsCommit;
}
info(int2Str(i));
}