Postman collection
Suppliers Write Deprecated

pixi_CreateSDeliveryByTemplate

Creates a new supplier delivery (status NEW) from one or more confirmed supplier orders and then runs a delivery header list query.

Legacy wrapper that creates a supplier delivery document (SDelHeader / SDelDetail) using supplier orders as a template, then calls a paged list of delivery headers.

Step 1 – create the delivery (via Pixi_CreateSDeliveryByTemplate):

  1. OrderNr is split at ;. Each element is matched against the internal number (InternalNumber) of a supplier order.
  2. Only supplier orders in a suitable status are used. This depends on the setting ConfirmOrderedDocumentOnDelivery:
    • 0: orders whose status is flagged as confirmed (IsConfirmed = 1).
    • 1: orders whose status is flagged as ordered-confirmed (IsOrderedConfirmed = 1). These orders are then switched to the first confirmed status. Confirmation date, confirming user, modification date and modifying user are also set.
  3. If no order qualifies, nothing is created.
  4. Otherwise one delivery header is inserted with these values:
    • status NEW and location LocID
    • the supplier number of one of the found orders
    • the full OrderNr string as external order number
    • UserName as creating and updating employee, and the current date
  5. For every supplier order line with an open quantity > 0, one delivery line is created. Open quantity is Qty - DeliveredQty - UndeliveredQty.
    • Delivered quantity is 0 and the ordered quantity is the open quantity.
    • Supplier price and discount are taken from the order line. A percentage discount is used directly; an amount discount is converted to a percentage per unit.
    • Final price and mid price are the price minus the discount amount.

Step 2 – list query (via Pixi_GetSDelHeaderByPage): the code queries delivery headers of location LocID with status NEW or INV (the ShowInv = NULL argument becomes 1). The call passes page number 0, so the row window is RowNum BETWEEN -PerPage+1 AND 0. As a result the returned result set never contains rows.

The ID of the new delivery is not returned.

Notes

  • A code comment states that this API call is no longer maintained.

  • The returned result set is always empty because page 0 is requested. Do not rely on it to find the new delivery. Query the delivery headers separately, for example by location, status NEW and external order number.

  • Only the detail insert runs inside a transaction. These steps run before it and are not rolled back if the detail insert fails:

    • the status update of the supplier orders (setting 1)
    • the header insert

    A failure can therefore leave a delivery header without lines.

  • If the setting ConfirmOrderedDocumentOnDelivery has a value other than 0 or 1, no order qualifies and nothing is created.

  • If the orders belong to different suppliers, the header gets the supplier number of one arbitrary order (TOP (1) without ORDER BY). The lines of all orders are still added.

  • If UserName is NULL, the inner procedure uses TemplateFromBuying.

  • CONTEXT_INFO is set to 0x10005 during the line insert to bypass the SDelDetail_IUD trigger.

  • Order data is read with NOLOCK.

  • The page size of the list query comes from the setting BuyingShowPerTab (fallback 500).

  • OrderNr is limited to 1000 characters in this wrapper.

Parameters

Parameter Type Default Description
OrderNr
Required
varchar(1000)
string
–

Internal numbers of the supplier orders to use as template, separated by ;. The full string is also stored as external order number of the delivery.

Example: 100234;100235

LocID
Required
varchar(3)
string
–

Location (warehouse) ID for the new delivery. The list query is also filtered by this location.

Example: 001

UserName
Required
varchar(50)
string
–

User name stored as creating/updating employee. It is also used to confirm the orders when the setting is 1. NULL becomes TemplateFromBuying.

Example: jdoe

Response

Result set 1 · Always; it never contains rows because the code requests page 0.

Delivery header list of the location (status NEW or INV), produced by the inner list procedure.

Column Type Description
SDelHKey int

Delivery header key.

SDelHDate
Nullable
datetime
dateTime

Delivery date.

SDelHLocationID
Nullable
string

Location ID.

SDelHSupplNr
Nullable
string

Supplier number.

SDelHNr
Nullable
string

Delivery number.

SDelHNote
Nullable
string

Note.

SDelHStatus
Nullable
string

Status (NEW, CLS, INV).

SDelHCreateDate
Nullable
datetime
dateTime

Creation date.

SDelHCreateEmp
Nullable
string

Creating employee.

SDelHUpdateDate
Nullable
datetime
dateTime

Last update date.

SDelHUpdateEmp
Nullable
string

Last updating employee.

SDelHextInvoiceNr
Nullable
string

External invoice number.

SDelHextOrderNr
Nullable
string

External order number(s), ;-separated.

SDelHfinalDicsount
Nullable
decimal

Final discount of the delivery.

PiccoUser
Nullable
string

Picco user working on the delivery.

LockedByPicco
Nullable
string

Lock flag set by Picco.

SupplName
Nullable
string

Supplier name (left join).

SuppliersKey
Nullable
int

Supplier key (left join).

ExternalReceiptNr
Nullable
string

External receipt number.

Error messages

Status Message Cause
RAISERROR ERROR --- %s Inserting the delivery lines failed; `%s` is the original SQL error message. The line insert is rolled back, but the header and any order status changes remain.

Examples

POST https://apigateway.descartes.com/tms/pixi/
Content-Type: text/xml; charset=utf-8
Authorization: Basic BASE64(USERNAME:PASSWORD)

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://apigateway.descartes.com/tms/pixi/">
  <SOAP-ENV:Body>
    <ns1:pixi_CreateSDeliveryByTemplate>
      <OrderNr>100234;100235</OrderNr>
      <LocID>001</LocID>
      <UserName>jdoe</UserName>
    </ns1:pixi_CreateSDeliveryByTemplate>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Tables used

SupplierOrder · Write SupplierOrderStatus · Read SupplierOrderLine · Read Suppliers · Read SDelHeader · Write SDelDetail · Write
SQL object:
dbo.pipi_CreateSDeliveryByTemplate
Procedure last changed on 2026-10-05
Documentation written by claude-opus-5-5 on 2026-10-30