Postman collection
Suppliers Read

pixiGetSOrders

Returns supplier orders (purchase orders) of one location, filtered by status, overdue/missing delivery dates, status change date and external order numbers.

Returns supplier orders from pixi.SupplierOrder together with supplier, status, location, creating/modifying user and the related goods receipts. The statement is built as dynamic SQL and executed with sp_executesql.

Filters

  • Only orders whose delivery location has LocID = LocationID (default 001).
  • At most RLimit rows are returned (TOP (@RLimit)). The default 0 returns no rows, so a positive value must be passed.
  • Status filter:
    • If ShowDueDate and ShowNoDate are both 0, the flags are combined with OR: ShowNew → status flag IsNew, ShowOrd → IsOrdered, ShowCon → IsConfirmed, ShowCls → IsClosed.
    • If ShowNoDate = 1, only ordered orders (IsOrdered) with at least one order line without an estimated delivery date are returned. This takes precedence over ShowDueDate.
    • If ShowDueDate = 1 (and ShowNoDate = 0), only ordered orders with at least one line whose estimated delivery date is earlier than now are returned.
    • In both date modes the flags ShowNew, ShowOrd, ShowCon and ShowCls are ignored.
    • If all six flags are 0, no status filter is applied.
  • Status change date: if StatusChangeDateFrom and/or StatusChangeDateTo is set, only orders whose latest audit entry in hist.pixi_SupplierOrder (MAX(AuditDate)) lies in the range >= From and < To are returned.
  • External order numbers: if ExtOrderNrs is set (an XML list), only orders whose ExternalCode matches one of the listed numbers are returned.

Goods receipts For each goods receipt in SDelHeader, the field SDelHextOrderNr is split at ;. Numeric parts are matched to the order's InternalNumber. The goods receipt numbers (SDelHNr) are returned in GoodsReceipts as a list separated by ; .

Rows are sorted by OrderDate descending.

Notes

  • Pitfall RLimit: the default 0 leads to TOP (0) and an empty result. There is no "unlimited" value.
  • Pitfall status change date: if only StatusChangeDateFrom is passed, the upper bound falls back to MAX(AuditDate). The condition MAX(AuditDate) < MAX(AuditDate) is never true, so no orders are returned. Pass StatusChangeDateTo as well, or only StatusChangeDateTo. The upper bound is exclusive.
  • NULL values for the flags, LocationID and RLimit are replaced by their defaults. An empty or whitespace-only ExtOrderNrs is treated as NULL.
  • ExtOrderNrs is parsed element-centric with OPENXML at path /ExtOrders/ExtOrder, reading the child element ExtOrderNr. The XML document is not released with sp_xml_removedocument.
  • All tables are read with NOLOCK, so uncommitted data can appear.
  • Orders are joined with INNER JOIN to supplier, status, location and to ucs_users for both the creating and the modifying user. Orders without a matching record are not returned.
  • GoodsReceipts is built with a varchar(100) conversion, so long lists are truncated. The goods receipt list is computed over the whole SDelHeader table on every call, which can be slow on large databases.
  • RecordBatchNr and PixiOrderCreated are always NULL. They are kept for compatibility.

Tables used

pixi_SupplierOrder · Read SDelHeader · Read SupplierOrder · Read Suppliers · Read SupplierOrderStatus · Read Location · Read ucs_users · Read SupplierOrderLine · Read
SQL object:
dbo.pipiGetSOrders
Updated at 2026-10-30