Postman collection
Orderlines Write

pixiDeleteOrderline

Deletes an orderline (or the whole bundle it belongs to) and removes the order if no orderlines remain.

Deletes the orderline identified by OrderlineKey inside one transaction.

  1. Check: the orderline must exist in Orderlines and have one of the statuses HAL, ANG, STO, NLB or FUT. Otherwise an ERROR row is returned and nothing is changed.
  2. Bundle handling: if the orderline has a BundleOrderlineRef, the whole bundle is deleted, not only the given line.
  3. Status reset: the orderline (or all lines of the bundle) of the same order that have no BoxNr are set to status NEW with UpdateEmp = API.
  4. Deletion: all affected lines in status NEW are detached from the order: OrderNr, CustRef, AddrRef, ShipAdrRef, Qty, prices, discounts and ShipCost are set to 0, ItemRef, ShipRef, Order_Id and BundleOrderlineRef to NULL. The bundle header in BundleOrderlines is deleted if it has status NEW. Reservations (Reservation) of the affected lines are deleted.
  5. Empty order: if the order has no orderlines left afterwards, the order header is deleted together with its entries in PL_NotReservedOrdersCheck, TagMatch and OrderHeaderAttribute.

The call returns exactly one row with ReturnCode (OK or ERROR) and a text in ErrorMessage. For bundles the success text names both the given orderline and the bundle key.

Notes

  • All changes run in one transaction; on an error caught by the call it is rolled back and an ERROR row is returned.
  • The orderline rows are not physically deleted. They are reset (OrderNr = 0 etc.); according to a code comment a job removes them overnight. That job is not part of this call.
  • The status check uses NOLOCK, so it may read uncommitted data.
  • Triggers on Orderlines and Reservation are suppressed via CONTEXT_INFO during the update/delete.
  • Only the given orderline is checked for an allowed status. For bundles, all other component lines without BoxNr are set to NEW regardless of their current status and deleted. Lines that already have a BoxNr keep their status and are not deleted.
  • The called sub-procedures catch their own errors and write them to log.InsertError without re-raising. Depending on the transaction state, a failure inside them may surface as a transaction-count error in the ERROR row, or the call may report OK although the sub-step was rolled back to its savepoint.

Tables used

Orderlines · Write BundleOrderlines · Write Reservation · Write OrderHeader · Write PL_NotReservedOrdersCheck · Write TagMatch · Write OrderHeaderAttribute · Write
SQL object:
dbo.pipiDeleteOrderline
Updated at 2026-10-30