Postman collection
Orders Read

pixiGetOrderHeader

Returns order headers with customer, billing and shipping address, invoice, shipment, voucher and tag data, selected by order number, external order number or filters.

The call selects order headers in one of three modes and returns one row per order.

Parameter normalisation

  • OrderNr = 0, CustKey = 0 and empty strings for OrderNrExternal, ShopID, PaymentType, ShippingCountry are treated as not set.
  • Date parameters (FromTime, UntilTime, FromUpdateTime) that lie more than 100 years in the past (e.g. 1900-01-01) are treated as not set.
  • RowCount = NULL becomes 1000.

Selection modes (the first matching rule wins)

  1. OrderNr set: the order with this OrderNr. Optionally restricted by CustKey and ShopID (the customer's CustomerOf). All other filters are ignored.

  2. OrderNrExternal set: orders with this external order number, optionally restricted by CustKey and ShopID. All other filters are ignored.

  3. Any of FromTime, UntilTime, ShopID, PaymentType, ShippingCountry, CustKey, FromUpdateTime set: filter search, combined with AND:

    • OrderDate > FromTime and OrderDate < UntilTime (both exclusive)
    • UpdateDate > FromUpdateTime (exclusive)
    • CustRef = CustKey
    • customer's CustomerOf = ShopID
    • country of the shipping address = ShippingCountry
    • payment type (APayment) of the billing address = PaymentType

    At most RowCount orders are taken, oldest CreateDate first.

  4. No parameter set: an empty result is returned (backward compatibility).

Returned data

  • Header fields from the order, customer data, billing address payment/bank data and shipping address name/address data.
  • Aggregates over the order lines: Shipdate/LastShipdate (earliest/latest ScanOutDate of linked invoices), TrackingID, ShipVendor, LastInvoiceNr (highest invoice number), VoucherID (highest voucher ID on the lines) with VoucherAmount from the voucher table, EstimatedDelivery (latest estimated delivery date) and TotalDiscount (sum of DiscountValue × Qty for lines not in status STO or NLB).
  • Only invoices that are not credit notes (no reference to another invoice) are considered. Lines in status MIN are always considered; other lines only if the invoice line quantity is > 0 or no invoice line exists.
  • Gender is derived from the salutation of the shipping address: 1 for Herr, Hr., M., Monsieur, Mr, Mr.; 2 for Mrs, Mrs., Ms, Ms., Frau, Fr.; otherwise 0.
  • Tags contains the names of the order's tags, sorted by name and separated by |.

The rows are sorted by CreateDate ascending and limited to RowCount. If no order matches, an empty result set with the same columns is returned.

Notes

  • All tables are read WITH (NOLOCK); uncommitted data may be returned.
  • The filter search (mode 3) is built as dynamic SQL; only the set filters are added to the WHERE clause.
  • For paging/incremental export use FromUpdateTime or FromTime together with RowCount. Note that the selection is ordered by CreateDate, not by UpdateDate, and the time filters are exclusive (>/<).
  • RowCount = 0 returns no rows; a negative value causes a SQL error from TOP.
  • Orders without matching currency, customer, billing address or shipping address record are not returned (inner joins). Orders without order lines are returned with empty aggregate columns.
  • If an order line is linked to several invoice lines, its discount is counted once per invoice line in TotalDiscount.
  • OrderTotal_OrderCurr contains the same value as OrderTotal. OrderLocked comes from the lock flag of the shipping address (N if empty). CustomerNr is the customer's DATEV account number.
  • The settings NumberOfDecimalPlacesForPrices and UseInitialOrderDate are read but do not affect the result.
  • If the call runs longer than 5 seconds, the parameters and the dynamic SQL are passed to LOG.EventDurationInsert (definition not attached; presumably writes a duration log entry).

Tables used

OrderHeader · Read Customers · Read Addresses · Read Orderlines · Read Orderline_EstimatedDelivery · Read Invlines · Read Invoices · Read Voucher · Read Currency · Read Settings · Read Tag · Read TagMatch · Read
SQL object:
dbo.pipiGetOrderHeader
Updated at 2026-10-30