Postman collection
Suppliers Write Deprecated

pixiCreateSDeliveryByTemplate

Creates a new supplier delivery (status NEW) at a location from one or more confirmed supplier orders and returns its header.

Creates a supplier delivery document (SDelHeader with SDelDetail lines) using one or more supplier orders as a template.

  1. OrderNr is split at ; into supplier order numbers (the InternalNumber of the supplier order, e.g. a BES number). Leading and trailing spaces are trimmed.
  2. If a delivery with status NEW already exists at location LocID whose SDelHextOrderNr contains any of the given numbers, the call stops and returns a single row with the column ERROR.
  3. Otherwise the internal procedure Pixi_CreateSDeliveryByTemplate is executed:
    • Only supplier orders whose status counts as confirmed are used. Which status flag is checked depends on the setting ConfirmOrderedDocumentOnDelivery: 0 requires IsConfirmed = 1, 1 requires IsOrderedConfirmed = 1.
    • If no supplier order qualifies, nothing is created.
    • With setting 1, the qualifying supplier orders that are not yet confirmed are set to the confirmed status (confirmation date and user are set).
    • One delivery header is inserted with status NEW, the given location, the supplier of one of the orders, SDelHextOrderNr = the full OrderNr string, and UserName as creating/updating user (default TemplateFromBuying if NULL).
    • For every supplier order line with an open quantity (Qty - DeliveredQty - UndeliveredQty > 0) a delivery line is inserted with delivered quantity 0, the open quantity as ordered quantity, the supplier price and the discount converted to percent and final price.
  4. Finally the header of the created delivery is returned (SDelHKey, date, location, number, status, external order number, supplier).

Notes

  • The code comment states that this API call is no longer maintained.
  • The duplicate check uses a substring match (CHARINDEX) on SDelHextOrderNr: a number such as BES100 is also found inside BES1000, so the check can report false positives.
  • If no supplier order qualifies (unknown number, wrong status, or the setting ConfirmOrderedDocumentOnDelivery has a value other than 0/1), no delivery is created and the header result set is empty; no error is returned.
  • If the orders belong to different suppliers, the header gets the supplier of an arbitrary one of them (TOP (1) without order), while lines from all orders are added.
  • The header insert and the optional status update of the supplier orders run outside the transaction; only the line insert is transactional. If the line insert fails, the header remains without lines and the error is raised as ERROR --- <message>.
  • CONTEXT_INFO is set during the line insert to suppress the trigger on SDelDetail.
  • Reads use NOLOCK. The user ID for confirmation is resolved via inf.UserGetByName, which is not attached.

Tables used

SDelHeader · Write SDelDetail · Write SupplierOrder · Write SupplierOrderStatus · Read SupplierOrderLine · Read Suppliers · Read
SQL object:
dbo.pipiCreateSDeliveryByTemplate
Updated at 2026-10-30