Postman collection
Stock Read

pixiInventoryItemsToRefill

Returns the Artikel that must be moved from a source location to a target location to cover minimum stock and open customer orders, with the source Lagerplätze to pick from.

Builds a replenishment (refill) list between two warehouse locations. The call passes all parameters to the internal procedure CR_InventoryItemsToRefill, which does the work.

Demand in the target location (ToLocID)

  • Open customer orders: sum of Orderlines.Qty per Artikel in ToLocID with status ANG, BES, BOR and HAL. HAL is left out when the setting InventoryItemsToRefill_NoHAL is 1.
  • Orders on hold: sum of Qty of order lines with status HAL in ToLocID. This value is returned for information only.
  • Stock per location comes from ItemLocationSpecific (LocationQuantity, MinStockQty, TargetStock).

Which Artikel are selected

  • The Artikel has an ItemLocationSpecific record for ToLocID.
  • FromLocID differs from ToLocID.
  • Positive minimum stock plus open customer order quantity is greater than the stock in ToLocID.
  • The Artikel is stored on at least one Lagerplatz (InvBin) of FromLocID.

Missing quantity

It is calculated as positive MinStockQty + open customer order quantity − stock in ToLocID − stock in AdditionalLocID (the last term only if AdditionalLocID is set).

Allocation to source bins

  • All bin entries (InvBinItem) of the Artikel in FromLocID are used. Entries that are referenced by a non-expired picklist item (PLitem) are skipped.
  • The entries are numbered oldest first (CreateDate). Only the first MissingQty entries are kept.
  • The result has one row per Artikel and source Lagerplatz. MissingQty is the number of entries taken from that bin. FromBinqty is the total quantity of the Artikel on that bin.
  • ToLocIDbinName/ToLocIDbinSortNum show one Lagerplatz of the Artikel in ToLocID, if there is one.

Sort order

With SortBy = '1' the rows are sorted by ToLocIDbinSortNum, otherwise by FromLocIDbinSortNum. Within that, rows are sorted by ItemName.

Notes

  • Read-only. All tables are read WITH (NOLOCK), so the result can contain uncommitted data.
  • The allocation counts bin entries (InvBinItem rows), not quantities. The MissingQty returned per bin is therefore the number of entries taken from that bin. Its sum over all bins of an Artikel can be lower than the calculated shortage if there are fewer entries.
  • The selection filter does not subtract the stock of AdditionalLocID, but the missing quantity does. If the additional location covers the shortage, the missing quantity is 0 or less and the Artikel does not appear.
  • ToLocIDbinName is taken with TOP 1 without an ORDER BY. If the Artikel has several Lagerplätze in ToLocID, which one is shown is not defined.
  • The setting is read through fpixi_GetSetting, whose definition is not attached. If it returns NULL instead of an empty value, HAL is also excluded.
  • FromLocQty and MinStockQty can be empty if no matching ItemLocationSpecific value exists.
  • If FromLocID equals ToLocID, the result is always empty.

Tables used

Orderlines · Read ItemLocationSpecific · Read Items · Read InvBinItem · Read InvBin · Read PLitem · Read
SQL object:
dbo.pipiInventoryItemsToRefill
Updated at 2026-10-30