Postman collection
Items Write

pixiSetItemSupplier

Creates or updates the supplier assignment (AddItems row) of an item, including supplier price, supplier item number, EAN and order settings.

Maintains the supplier data of an item in AddItems for the supplier given in SupplNr.

Validation

  1. ItemKey = 0 and empty strings in EAN, ItemNrSuppl and ItemNrInt are treated as NULL.
  2. If both ItemKey and ItemNrInt are passed, they must belong to the same item in items.
  3. The supplier SupplNr must exist in Suppliers.
  4. At least one of ItemKey, EAN, ItemNrSuppl or ItemNrInt must be passed.

Identifying the item The item is searched in the existing AddItems rows (joined with items). A row matches if any of these is true:

  • ItemRef = ItemKey
  • EANUPC = EAN
  • ItemNrInt = ItemNrInt
  • ItemNrSuppl = ItemNrSuppl and SupplNr = SupplNr

Exactly one distinct item must be found; otherwise an error row is returned.

  • With AddEAN = 0, it is an error if more than one matching AddItems row exists for the given supplier.
  • With AddEAN = 1, a warning is returned if a row with the same EAN and supplier already exists.

Writing

  • If PreferredSupplier = 1, PreferredSupplier is first reset to 0 on all AddItems rows of the item, so only one row stays preferred.
  • If AddEAN = 0 and a matching AddItems row of that supplier exists, the oldest one (lowest UpdateDate) is updated. Parameters that are not passed keep the existing values; for price, supplier item number and EAN the item master values are used as fallback. The call returns Record updated.
  • Otherwise (no row for this supplier yet, or AddEAN = 1), a new AddItems row is inserted. Values come from the parameters, with fallback to the item master (EANUPC, ItemNrSuppl, SupplPrice). ItemNrInt, IntLinkNR1, IntLinkNR and Price are copied from the item, and AutoPrice is set to 0. The call returns New record inserted.

The call always returns exactly one status row with Status and Message.

Notes

  • The item must already have at least one AddItems row. The lookup only searches AddItems, so an item without any supplier row returns No items found with given parameters., even if ItemKey is valid.
  • With AddEAN = 1 and a new EAN, the item can only be identified through an existing value. Pass ItemKey or ItemNrInt, because the new EAN cannot be found in AddItems yet.
  • The search conditions are combined with OR. Passing several identifiers that point to different items leads to More then one item was identified ....
  • When a new row is inserted, MinOrderQty and SupplDeliveryTime take only the passed values (NULL if omitted). OrderOnlyPackageUnits and PreferredSupplier default to 0.
  • In the success message, NULL values are not handled. If the resulting ItemNrSuppl or EANUPC is NULL, Message is NULL.
  • Writes run in a transaction. If the caller already has an open transaction, a savepoint is used instead. On error the changes are rolled back, the error is logged via log.InsertError (definition not attached) and an Error row with the SQL error text is returned.
  • Reads use NOLOCK; updates use ROWLOCK.

Tables used

items · Read Suppliers · Read AddItems · Write
SQL object:
dbo.pipiSetItemSupplier
Updated at 2026-10-30