Postman collection
Orderlines Write

pixiCancelOrder

Cancels all open order lines of an order by setting their status to `STO` (cancelled) or `NLB` (not deliverable).

Sets the status of the order lines of the order OrderNr to the value of Status.

  1. If Status is empty or NULL, STO is used.
  2. Only STO and NLB are accepted. Any other value returns a row with ErrorMessage and nothing is changed.
  3. The call selects the order lines of the order that meet all of these conditions:
    • the line's current status is not a final status (OrderStates.FinalState = 'Y');
    • no order line of the order is referenced in BoxItems;
    • no order line of the order is referenced in InvLines.
  4. The selected lines get the new Status. UpdateDate is set to the current time and UpdateEmp to API.
  5. If at least one line was updated, the call returns a row with SuccessfulMessage. If no line was updated, the call returns no result set; the procedure's return code is then 1 (on success it is 0).

Notes

  • Order-wide check: The comments in the code suggest a per-line check. However, the BoxItems and InvLines subqueries are only correlated on the order number. If any line of the order is already in a box or on an invoice, no line is cancelled, not only that one line.
  • Lines in a final status are skipped. Calling the call again for an order that is already cancelled therefore usually returns no rows.
  • If nothing was changed, no message is returned (e.g. unknown order, all lines final, lines boxed or invoiced). Callers should treat a missing SuccessfulMessage row as "not cancelled".
  • The selection reads with NOLOCK; the update uses ROWLOCK. There is no explicit transaction.
  • Only the order line statuses are changed. The order header and stock reservations are not touched directly by this procedure.

Tables used

Orderlines · Write OrderStates · Read BoxItems · Read InvLines · Read
SQL object:
dbo.pipiCancelOrder
Updated at 2026-10-30