Postman collection
Items Write

pixiDeleteItemSupplier

Deletes the supplier assignment (AddItems record) of an Artikel for a given Lieferant, provided no open supplier orders exist for it.

Removes exactly one item-supplier record from AddItems.

  1. ItemKey = 0 is treated as NULL, an empty ItemNrInt as NULL.
  2. Candidate items are all rows in Items where ItemNrInt = @ItemNrInt or ItemKey = @ItemKey or EANUPC = @EAN. The criteria are combined with OR, so several items can become candidates.
  3. In AddItems, the records of these candidate items are searched that belong to @SupplNr. If @EAN is given, the EanUpc of the AddItems record must also match.
  4. If no record is found, the error No records found with provided parameters. is returned. If more than one record is found, the error Item could not be uniquely identified. is returned. In both cases nothing is changed.
  5. If any candidate item appears on a supplier order of this Lieferant whose status is flagged as open (IsAllOpen = 1, e.g. NEW, BES, CON), an error is returned and nothing is deleted.
  6. Otherwise the AddItems record is deleted inside a transaction (or a savepoint if the caller already has an open transaction).
  7. If @EAN was given, the item's main barcode in Items.EanUpc equals @EAN, and no AddItems record of the candidate items carries that EAN anymore, Items.EanUpc is replaced by the EanUpc of one of the remaining AddItems records of the item. Records of suppliers other than MGS are preferred.
  8. A single status row with STATUS and MESSAGE is returned.

Notes

  • All lookups use NOLOCK, so the uniqueness and open-order checks can see uncommitted data.
  • Because the item criteria are combined with OR, passing several identifiers that point to different items widens the candidate set. The open supplier order check and the barcode update apply to all candidate items, not only to the item whose AddItems record was deleted.
  • If no AddItems record remains for an item when the barcode is replaced, Items.EanUpc is set to NULL.
  • An empty string for EAN is not converted to NULL; it is used as a filter value.
  • The success message only contains ItemNrInt if it was passed; when calling with ItemKey or EAN only, that part is empty.
  • The success row is produced before the temporary tables are dropped via util.TempTableDrop (not attached) and before the commit. If an error occurs at that point, an additional error row may follow.
  • Errors inside the delete/update block are caught, the transaction (or savepoint) is rolled back and an Error row is returned instead of a SQL error.

Tables used

Items · Write AddItems · Write Suppliers · Read SupplierOrder · Read SupplierOrderLine · Read SupplierOrderStatus · Read
SQL object:
dbo.pipiDeleteItemSupplier
Updated at 2026-10-30