Canceling purchase order and sales order lines

Canceling purchase order lines

       PurchLine purchLine;
       ttsbegin;
       while select forupdate purchLine where purchLine.PurchId == 'PO-XXXXXX'
       {
           if (purchLine)
           {
               purchLine.RemainInventPhysical  = 0;
               purchLine.RemainPurchPhysical   = 0;
               purchLine.update();              

               InventMovement::bufferSetRemainQty(purchLine);
            }
        }
        ttscommit;

Canceling sales order lines

       SalesLine salesLine;
       ttsbegin;
       while select forupdate salesLine where salesLine.SalesId == 'SO-XXXXXX'
       {
           if (salesLine)
           {
               salesLine.RemainSalesFinancial  = 0;
               salesLine.RemainInventFinancial   = 0;
               salesLine.update();              

               InventMovement::bufferSetRemainQty(salesLine);
            }
        }
        ttscommit;

Comments

Popular posts from this blog

Dynamics 365 Finance & Operations Release pipelines import.

Attaching a user selected document to a purchase order using x++ job (Runnable class) in Dynamics 365 for Finance and Operations

Claude AI Models Comparison (Updated: July 2026): Haiku 4.5 vs Sonnet 5 vs Opus 4.8 vs Fable 5