When you're operating with catch weight items you need to include the CW remainder field.
The following code will cancel all open lines on a sales order that has been invoiced.
Don't forget tts.
while select forupdate salesLine
join salesTable
where salesTable.SalesId == "[Your SO]"
&& salesTable.SalesStatus == SalesStatus::Backorder
&& salesTable.DocumentStatus == DocumentStatus::Invoice
&& salesLine.SalesStatus == SalesStatus::Backorder
{
salesLine.RemainInventPhysical = 0;
salesLine.RemainSalesPhysical = 0;
salesLine.PdsCWRemainInventPhysical = 0;
salesLine.Update();
}
No comments:
Post a Comment