Postman collection
Orderlines Read

pixiCanCancelOrderline

Checks whether an order line can still be cancelled and returns 1 (yes) or 0 (no).

Scalar function that evaluates a single order line identified by OrderlineKey.

The order line is joined with OrderStates on its Status. The function returns 1 only if all of the following conditions are met:

  • the status of the order line is not a final state (OrderStates.FinalState is N or NULL),
  • the status of the order line is not EIN,
  • the order line is not referenced in BoxItems (not packed into a box),
  • the order line is not referenced in InvLines (not invoiced).

If any of these conditions fails, the function returns 0.

The function only checks; it does not change any data.

Notes

  • The result is NULL if no order line with the given key exists or if its Status has no matching entry in OrderStates (inner join).
  • All tables are read with NOLOCK, so the result can reflect uncommitted data.
  • The checks against BoxItems and InvLines use NOT IN. If BoxItems.OrderLineRef or InvLines.OrderlineRef contains NULL values, the condition never evaluates to true and the function returns 0 for every order line.
  • The function does not cancel anything; it only indicates whether a cancellation is allowed.

Tables used

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