Postman collection
Suppliers Write

pixiCreateDeliveryItem

Adds a new item line to an open supplier delivery, identified by delivery key or number, and returns the created delivery line.

Creates one new line (SDelDetail) in a supplier delivery (SDelHeader).

  1. Normalisation: empty values are treated as not given. For the numeric parameters this means that 0 counts as empty: SDelHKey = 0 and SDelHNr = 0 become NULL. Quantities and prices that are not given become 0.
  2. Mandatory input: either SDelHKey or SDelHNr, and either EANUPC or ItemNrInternal, must be set.
  3. Item lookup: the item is searched with COALESCE(EANUPC, ItemNrInternal) among the scannable item codes (pixi.ItemCode joined with ItemCodeType, Scannable = 1). If EANUPC is set, ItemNrInternal is ignored.
  4. Delivery lookup: if SDelHKey is empty, the key is taken from the first delivery with SDelHNr. If both are given, SDelHKey wins.
  5. Checks:
    • The delivery must exist and must not have the status CLS (closed) or INV (invoiced).
    • The delivery must not be locked by Picco (LockedByPicco = 'Y').
    • LocID must be empty, or at least one supplier delivery with SDelHLocationID = LocID must exist.
  6. Insert: the item name is taken from items and the supplier from the delivery header. A new line is always inserted, with the ordered and delivered quantities, purchase price, final price, batch number and best-before date. There is no order line reference. Discounts and the mid price are set to 0.
  7. Price fallback: if SupplPrice is 0 or not given and the delivery has a supplier, the purchase price is taken from the supplier item record (AddItems.SupplPrice). This value is used for the price, the mid price and the final price. In this case a given SupplFinalPrice is overwritten as well.
  8. Result: the newly created delivery line is returned with additional information:
    • quantity matched to supplier order lines
    • open customers, open orders and open quantity for the item in the delivery's location
    • supplier item number and internal item number from the supplier item record

All errors are raised with RAISERROR (severity 16). No line is created in that case.

Notes

  • SDelHSupplNr and PiccoUser are accepted but not used; SDelHSupplNr is marked as unused in the code (DEV-4203). The supplier always comes from the delivery header.
  • Location check: the LocID check does not compare against the location of the target delivery. It only checks whether any supplier delivery with this location ID exists.
  • Duplicate lines: calling the procedure again for the same item creates an additional line. Existing lines are never updated; the error text points to pixiUpdateDeliveryItem for updates.
  • Supplier item creation: if the setting InsertAddItemOnSOrdersDragDrop is 1 and no supplier item record (AddItems) exists for the delivery's supplier and the item, the internal procedure Pixi_InsertAddItemOnDelivery is called. That procedure is not attached, so its exact effects are not documented here; it presumably creates such a record.
  • Price may be NULL: with the price fallback, the price becomes NULL if the supplier has no supplier item record for the item.
  • Duplicated error text: if only the delivery reference is missing, the validation logic concatenates the message twice, so the error text appears twice.
  • User name: if UserName is sent as an empty string, it becomes NULL and is stored as NULL creator/updater.
  • Reads use NOLOCK. No explicit transaction is used.

Tables used

SDelHeader · Read SDelDetail · Write items · Read ItemCode · Read ItemCodeType · Read AddItems · Read BuyingMatch · Read Customers · Read Orderlines · Read OrderStates · Read OrderHeader · Read Suppliers · Read
SQL object:
dbo.pipiCreateDeliveryItem
Updated at 2026-10-30