Postman collection
Suppliers Write

pixiSupplierOrderCreate

Creates a supplier order or pre-order from an XML document for a supplier, delivery location and order location.

Creates a supplier order (Type = 1) or a pre-order (Type = 2). The actual creation is delegated to the internal procedure pixi.SupplierOrderCreate. This wrapper resolves the input values and formats the response.

Steps:

  1. Any Type other than 2 is treated as 1.
  2. For supplier orders (Type = 1), OrderConsiderationStartDate must be empty. Otherwise an error row is returned and nothing is created.
  3. A transaction is started. If the caller already has an open transaction, a savepoint is set instead.
  4. UserId is resolved from UserName if not given. Unknown user names fall back to the user pixiAdministration.
  5. The supplier is resolved by SupplierId (Suppliers.SuppliersKey), or by SupplierNr (SupplNr) if SupplierId is NULL.
  6. Delivery location and order location are resolved by their key (DeliveryLocationId, OrderLocationId), or by the location code LocID (DeliveryLocation, OrderLocation) if the key is NULL. A given ID that does not exist resolves to NULL. The code then does not fall back to the code value.
  7. Input values are normalised:
    • ConsiderPackageUnits and ConsiderMinOrderQty: NULL becomes 0.
    • EstimatedDeliveryDate and OrderConsiderationStartDate: the time part is removed.
    • ExternalCode: an empty string becomes NULL.
  8. pixi.SupplierOrderCreate is executed with the order document SupplOrderDocument and all resolved values.
  9. If ShowDetailedReturn = 1, a detail result set is returned. It has one row per item line of the input and shows how each line was matched. The status is one of OK, Item not found, Item does not have the correct supplier assigned or Item number supplier is missing for the item. The row also contains the created order and order line if one exists. If ShowDetailedReturn = 0, the inner procedure is asked to return the created IDs instead.
  10. If the call opened its own transaction, it is committed. After the commit, a ReturnCode/ErrorMessage row is returned if the supplier, delivery location or order location could not be resolved.

Notes

  • The structure of SupplOrderDocument and the actual inserts are defined in pixi.SupplierOrderCreate, which is not attached. The XML layout, the result set with the created IDs and the tables written cannot be derived from this code. The detail output suggests that lines identify items by internal item number (matched against pixi.ItemCode with CodeTypeId = 2), by supplier item number or by item ID.
  • Supplier and locations are validated only after the inner procedure has run and the transaction has been committed. Their validation message is therefore not a guarantee that nothing was written.
  • If the call runs inside an outer transaction, no validation message is returned at all. The commit is then also left to the caller.
  • The validation row uses the ReturnCode value Error with a trailing space, while other errors use ERROR.
  • In detailed mode, the created order is determined as MAX(Id) of pixi.SupplierOrder. Under concurrent order creation, this may refer to a different order.
  • Lookups use NOLOCK.
  • Errors are caught. The transaction or savepoint is rolled back, and the error is returned as a ReturnCode = ERROR row, not as a SQL error.
  • AppName is required but not used by the code.

Tables used

Suppliers · Read Location · Read SupplierOrder · Read SupplierOrderLine · Read ItemCode · Read items · Read UCS_USERS · Read
SQL object:
dbo.pipiSupplierOrderCreate
Updated at 2026-10-30