Postman collection
Items Write

pixiSetItemBuyingInfoXML

Updates buying data such as minimum stock, minimum order quantity, order unit, target and safety stock for several items from an XML document.

Reads one Item element per article from /BuyingInfo/Item (element-centric) and writes the given values to the item master, the location-specific item data and the supplier item data.

Identifying the item

An item can be identified by ItemKey, ItemNrInt or EAN. The lookup runs in this order: by ItemKey, then by ItemNrInt, then by EAN. Each match overwrites the identifiers with those of the found item, so a later match wins. Entries for which no item is found are silently skipped.

Value cleanup

  • Empty text fields (ItemNrInt, EAN, Location, SupplierCode) and an empty or 0 ItemKey are treated as not given.
  • Quantity fields (MinStockQty, MinOrderQty, OrderUnit, VPE, TargetStock, SafetyStock) are only used if they are numeric; otherwise they are ignored.
  • OrderUnit and VPE are merged: if OrderUnit is given, its value is used for both; otherwise VPE is used for both.
  • A negative TargetStock is set to 0.
  • Fields that are not given (NULL) are not changed.

What is updated

  • MinStockQty: on the item master (items) only if no Location is given; in ItemLocationSpecific for all locations of the item if no Location is given, otherwise only for that location.
  • MinOrderQty: same rule as MinStockQty; additionally on the supplier item (AddItems) for the supplier given in SupplierCode (independent of Location).
  • OrderUnit / VPE: on the item master only, and only if no Location is given.
  • TargetStock and SafetyStock: only in ItemLocationSpecific, for all locations or only for the given Location.

Result

Returns one row per item that was found, with the resolved identifiers and the values that were applied.

Notes

  • All updates run in one transaction (or a savepoint if the caller already has an open transaction). On any error the changes are rolled back and the error is logged via log.InsertError; that object is not attached, so it is unknown whether the error is passed on to the caller. In that case no result set is returned.
  • ISNUMERIC also accepts values such as 1.5 or 1e3. Such values pass the check but fail when converted to int, which aborts and rolls back the whole call. Send integers only.
  • Item lookups use NOLOCK. If several items share the same EAN, the EAN lookup can pick any of them and override a match by ItemKey or ItemNrInt.
  • Values cannot be cleared: an empty element means "do not change". Use 0 to reset a quantity.
  • Location is not returned in the result set, and the returned row does not show whether a location or supplier record actually existed.
  • The header comment ("Set Tags for Items") does not match the actual function of the procedure.

Tables used

items · Write ItemLocationSpecific · Write AddItems · Write
SQL object:
dbo.pipiSetItemBuyingInfoXML
Updated at 2026-10-30