Postman collection
Stock Write

pixiSetStockMultiple

Sets or changes the stock of items on Lagerplätze (bins) from an XML document and returns one result row per processed bin entry.

Processes a list of items with bin entries and books stock movements (put to stock / take out) for each entry.

Steps

  1. Checks the setting API_Stock_Movements. If it is not enabled, a single ERROR row is returned and nothing else happens.
  2. If ParameterXML is not empty, it replaces XML. The whole XML text is converted to upper case (element names and values).
  3. The XML is read from /ITEMSTOCK/ITEM/INVBINS/INVBIN. Per ITEM: ITEMKEY, ITEMNRINT, EANUPC, OVERWRITESTOCK. Per INVBIN: BINNAME, STOCK, STOCKADD, STOCKREMOVE, NEUTRALINVENTORY, SMTREF, SMOREF, BATCHNUMBER, BESTBEFOREDATE. Empty SMTREF, SMOREF, BATCHNUMBER and BESTBEFOREDATE are treated as NULL.
  4. The item is resolved in this order: by ITEMKEY, then by ITEMNRINT, then by EANUPC. Item key, item number and EAN of the found item are filled in.
  5. If OVERWRITESTOCK = 1, an additional entry with target stock 0 is added for every other bin (by bin name) that holds a positive stock of the item and is not listed in the XML – so the item's stock is cleared there.
  6. If the highest STOCK (or STOCKADD when STOCK is empty) exceeds the setting MaxStockOperationLimit, the call aborts with an error before any stock is changed.
  7. Each entry with a found item and an existing bin name is processed:
    • If the item is tagged for Charge/batch number (tag -6) but no BATCHNUMBER is given, or tagged for best-before date (tag -7) but no BESTBEFOREDATE is given, the entry is skipped. If the item has no such tag, the value is ignored.
    • If STOCK is set, the difference to the current stock on all bins with this name is calculated. A positive difference becomes a put-to-stock quantity, a negative difference a take-out quantity; a difference of 0 yields the success message No stock change needed.
    • Otherwise STOCKADD / STOCKREMOVE are booked as given.
    • If SMOREF or SMTREF is missing, defaults are used: stock movement operation API/PutToStock with stock movement type 0201 for additions, API/TakeOut with type 0301 for removals.
    • The SMO/SMT combination must exist in the stock movement matching table; otherwise the entry fails with an error message.
    • The booking is done by Pixi_InvBinScanIn (addition) or Pixi_InvBinTakeOut (removal) with the given Username, Charge and best-before date.
  8. One result row per entry is returned: processed entries with their success or error message, entries whose item or bin was not found, and remaining unprocessed entries with the batch/best-before message.
  9. All resolved items are added to pixi.ItemRecalculateStockQueue for stock recalculation and export.

Notes

  • No overall transaction: every booking is committed separately by Pixi_InvBinScanIn / Pixi_InvBinTakeOut. A call can succeed partially; check status per row.
  • The XML is converted to upper case completely, so bin names and batch numbers (Charge) are processed in upper case.
  • Omit numeric elements instead of sending them empty: an empty STOCK may be read as 0 and would then set the stock to 0.
  • Bins are identified by BINNAME only. If the same bin name exists in several locations, the current stock is summed over all of them and the location is taken from an arbitrary matching bin (TOP 1). The setting FilterStockOperationsWithLocation is read but not used.
  • OVERWRITESTOCK = 1 clears the item on all other bins with positive stock, in all locations.
  • MaxStockOperationLimit is checked here only for STOCK/STOCKADD. The called procedures check the quantity again (also for take-outs); such an error is caught, logged and returned as a row with status 0 and an empty Error.
  • Do not combine STOCK with STOCKADD/STOCKREMOVE in the same entry: the explicit values may still be booked in addition. The calculated difference is also not reset between entries, which can affect entries without STOCK.
  • If the SMO is not assigned to application API, only an informational message (severity 10) is sent; the row is then reported with the misleading batch/best-before message.
  • Entries without any quantity to book (e.g. only NEUTRALINVENTORY, which is read but not used) also receive the batch/best-before message.
  • In the result, STOCKADD/STOCKREMOVE/SMOREF/SMTREF show the input values, not the calculated or default values. Reason is empty for XML entries and holds the bin item reason for entries added by OVERWRITESTOCK. The result has no defined sort order.
  • SMT/SMO mismatches and caught errors are written to LogTable. Texts returned by the booking procedures come from Pixi_InvBinScanIn_Base / Pixi_InvBinTakeOut_Base, which are not attached.
  • Lookups use NOLOCK.

Tables used

Settings · Read items · Read InvBin · Read InvBinItem · Read TagMatch · Read StockMovementOperations · Read StockMovementTypes · Read StockMovementMatching · Read LogTable · Write ItemRecalculateStockQueue · Write
SQL object:
dbo.pipiSetStockMultiple
Updated at 2026-10-30