In Produmex WMS, free stock is always calculated the same way: the stock WMS has on its locations, minus the stock that is reserved by locks. This calculation is done at four levels: item, batch, logistic unit and location. The real free quantity is the lowest of the four.
Each screen that shows free stock then adds its own filters on top of this calculation. This is why the Free stock screen, the Get Free Stock button on the sales order and a custom query on the free stock view can show three different numbers for the same item.
In short:
| Term | Meaning |
|---|---|
| Free stock | The physical stock WMS knows about, minus the stock that is reserved by a lock. |
| Stock | All stock WMS has on a storage location, whatever the location type: bin locations, docks, moving locations, pick carts and lost and found. Goods that are picked but not shipped yet are still included. |
| Lock | A reservation of stock. A lock can reserve an item, a batch, a logistic unit or a location. Locks are created by sales orders, pick list proposals and pick lists, 'Ready' pick lists, ad-hoc picking, production and Beas. Users can also create locks manually on the inventory report, on the stock allocation screen and with locking in advance (see Inventory locking). |
| Warehouse | The Produmex warehouse, not the SAP warehouse. One SAP warehouse can be linked to several Produmex warehouses. |
| Quality status | Both stock and locks are stored per quality status. A lock on status A never reserves stock with status B. The settings of the quality status (can be shipped, can be shipped under quarantine, can be used for production) decide which stock a screen counts. |
Free stock is the stock that is in the warehouse and not reserved for anything else. WMS calculates it in three steps.
1. WMS takes the stock on the locations
WMS starts with all the stock it has on its locations: bin locations, docks, pick carts, moving locations and so on. Goods that are picked but not shipped yet are still counted.
2. WMS subtracts the reserved stock
Stock is reserved with a lock. A lock can be broad or narrow, depending on what it reserves:
| A lock can reserve | Typical example |
|---|---|
| A quantity of an item, from anywhere in the warehouse | A reservation of the item without a batch, logistic unit or location |
| A quantity of a specific batch | A sales order reserves 90 pcs of batch 123 |
| A quantity on a specific logistic unit | A pick list reserves logistic unit 001 |
| A quantity on a specific location | A 'Ready' pick list or ad-hoc picking reserves the stock on location A-01-01 |
A narrow lock also counts for everything above it. For example, a lock on a location also reduces the free stock of the logistic unit, the batch and the item on that location.
A broad lock does not belong to any single logistic unit or location. For example, a sales order that reserves 90 pcs of a batch does not say which logistic units the goods will come from, so it reduces the free stock of every logistic unit of that batch.
3. WMS checks four levels and takes the lowest result
For every logistic unit on every location, WMS asks four questions:
| Level | Question |
|---|---|
| Item | How much of this item, with this quality status, is still free in the warehouse? |
| Batch | How much of this batch is still free? |
| Logistic unit | How much is still free on this logistic unit? |
| Location | How much is still free on this location? |
The lowest answer is the real free quantity, because users cannot take more than that without breaking a reservation.
Example
A logistic unit holds 20 pcs on location A-01-01. Nothing on the logistic unit or the location is reserved, so at logistic unit and location level 20 pcs are free. But a sales order has reserved most of the batch, and only 10 pcs of the batch are still free. The free quantity of this logistic unit is therefore 10 pcs, the lowest of the four answers.
| Level | Free quantity |
|---|---|
| Item | 10 |
| Batch | 10 |
| Logistic unit | 20 |
| Location | 20 |
| Free quantity of the logistic unit | 10 |
A reservation on an item or a batch is not linked to one logistic unit, so it is shown on every row of that item or batch. If users add up the free quantities of the rows, the same reservation is counted once for every row, and the total is too high.
| Logistic unit | Stock on the location | Free (item) | Free (batch) | Free (logistic unit) | Free (location) | Free quantity of the row |
|---|---|---|---|---|---|---|
| LU1 | 20 | 10 | 10 | 20 | 20 | 10 |
| LU2 | 20 | 10 | 10 | 20 | 20 | 10 |
| LU3 | 20 | 10 | 10 | 20 | 20 | 10 |
| LU4 | 20 | 10 | 10 | 20 | 20 | 10 |
| LU5 | 20 | 10 | 10 | 20 | 20 | 10 |
| Total | 100 | 50 |
Only 10 pcs are really free, but the rows add up to 50 pcs. Without reservations, the total is correct, because the free quantity of each row is simply the stock on it. This is why such a total looks correct on a test item, but is wrong on live data.
Free stock appears in several places in WMS, and each place calculates it in its own way. The basic calculation is always the same (stock minus reservations), but each place decides which stock to count. This is why the numbers can differ.
The table below shows, for each place:
| Screen or process | Result on the screen | Stock and reservations included |
|---|---|---|
| Free stock screen Opens when stock is selected for a delivery, an A/R invoice, an issue for production or another document that takes stock out | A list of logistic units and locations, with the free quantity of each | • Only stock of the item in the SAP warehouse of the document line • Only quality statuses allowed for the document type • Deliveries and A/R invoices: stock on disallowed locations is left out • Only rows with free stock are shown • Sorted by best before date, batch, pick location and logistic unit |
| Get Free Stock button on the sales order Fills the PMX Free Stock column of the lines | One number per sales order line | • All stock of the item in the SAP warehouse of the line, minus all reservations • Quality statuses based on the Shipping quality option of the line • Stock and reservations on disallowed locations are left out • Only lines with an open quantity are updated |
| Item Master Data, Inventory tab, PMX Free Stock column | One number per SAP warehouse | • Stock: only quality statuses that can be shipped • Reservations: all quality statuses • Stock and reservations on disallowed locations are left out • Updated when the item is opened or 'OK' is pressed. There is no Get Free Stock button on this screen. |
| Picking and other WMS processes Pick list proposals, picking, packing, production, moves, stock allocation, minimum customer stock and Beas | The stock WMS will actually use | • Uses the most rules of all, for example expiry dates, customer reservations and pick locations (see Filters added by each screen below) • This calculation decides what WMS actually picks. |
The free stock view itself does not filter anything. Each screen or process adds the filters it needs. The table shows which filters each one uses.
| Filter | What it does | Free stock screen (delivery) | Get Free Stock button | Item Master Data | Picking and proposals |
|---|---|---|---|---|---|
| Warehouse | Only counts stock in one warehouse | SAP warehouse of the line | SAP warehouse of the line | Per SAP warehouse | Produmex warehouse |
| Quality status | Only counts stock with certain quality statuses | • Delivery and A/R invoice: can be shipped, or can be shipped under quarantine • Issue for production: can be used for production • Other documents: all statuses | Based on the Shipping quality option of the line: • Released: can be shipped • Can use SUQ: can be shipped, or can be shipped under quarantine • Must use SUQ: can be shipped under quarantine only | • Stock: can be shipped • Reservations: all statuses | Set by the process. Pick list proposals use the same rule as the button, sample orders use all statuses. |
| Disallowed locations | Leaves out stock on disallowed locations | Yes (delivery and A/R invoice only) | Yes, for stock and reservations | Yes, for stock and reservations | Optional |
| Lost and found | Leaves out the lost and found location of the warehouse | Yes, as part of the disallowed locations | Yes, as part of the disallowed locations | Yes, as part of the disallowed locations | Optional |
| Reservations of the document itself | Does not subtract the reservations that the document itself created | No | No. The reservation of the sales order reduces its own free stock. | Not applicable | Optional |
| Customer reservations | Stock reserved for a customer counts as free for that customer | No | No | No | Optional |
| Expiry date and shelf life | Leaves out batches whose best before date is earlier than the date plus the shelf life. The shelf life can be set per item, customer and country. | No | No | No | Optional |
| Location type, pick location, bin location | Only counts stock on certain location types, pick locations or bin locations | No | No | No | Optional |
| Batch attributes | Only counts batches with matching batch attributes | No | No | No | Optional |
| Specific batch or logistic unit | Only counts one batch, best before date or logistic unit | No | No | No | Optional |
| Location of a reservation | For a reservation without a location, uses the current location of the logistic unit, or the location of the batch if the batch is on one location only | No | No | No | Yes, when disallowed locations are left out |
| Only free stock | Only shows rows with free stock | Yes | Not applicable (one number, which can be negative) | Not applicable | Yes |
Disallowed locations are locations that WMS does not use when it proposes stock for picking. WMS keeps a list of these locations, and some screens leave their stock out of the free stock (see Filters added by each screen above). The stock on these locations is still in the warehouse, it is only left out of the free stock on those screens.
The list contains:
A common way to calculate a free stock total is to add up ActualFreeQuantity on the free stock view, with filters on the warehouse, the disallowed locations and the quality status.
Such a query is not correct. The problem is not a missing filter, but the total itself: adding up ActualFreeQuantity counts item, batch and logistic unit reservations once for every row they cover, so the result is too high (see Why the free quantities of the rows cannot be added up above). For an item without reservations, or with location reservations only, the result is correct. This is why the query passes a quick test, but shows different numbers than the screens on live data.
The table below reviews the typical parts of such a query.
| # | Part of the query | Result | Why |
|---|---|---|---|
| 1 | SUM("ActualFreeQuantity") | Wrong | ActualFreeQuantity is the free quantity of one row, and item, batch and logistic unit reservations are repeated on every row they cover. Sales orders reserve batches, and pick list proposals and pick lists reserve batches or logistic units, so almost every reserved item is affected. |
| 2 | "StorLocCode" IN (SELECT "Code" FROM PMX_OSEL WHERE "PmxWhsCode" = ...) | Correct, with a limitation | This filters on the Produmex warehouse. The screens filter on the SAP warehouse (PMX_OSWH.SboWhsCode), which can be linked to several Produmex warehouses. The result is only the same when the codes match. |
| 3 | "StorLocCode" NOT IN (SELECT "Code" FROM PMX_DISALLOWED_LOCATIONS_FOR_PICKING) | Correct | Works the same way as the Free stock screen and the Get Free Stock button. Add WHERE "Code" IS NOT NULL, as the add-on does: a single empty (NULL) value in a NOT IN list makes the whole result empty. |
| 4 | "QualityStatusCode" IN (... "CanBeShipped"='Y' OR "CanBeShippedUnderQuarantine"='Y' OR "CanBeUsedForProduction"='Y') | Wrong for every screen | Mixes three different uses. The Free stock screen for deliveries counts statuses that can be shipped or shipped under quarantine. The Get Free Stock button (Released) and the Item Master Data count statuses that can be shipped only. Issue for production counts statuses that can be used for production only. Statuses that are only allowed for production make the free stock for sales too high. |
| 5 | No "ActualFreeQuantity" > 0 condition | Not relevant for a total | Only matters when listing rows. The Free stock screen uses this condition. |
Even the highest FreeQuantityItem per quality status cannot match the Get Free Stock button, because the item level stock in the view includes stock on disallowed locations, and the view cannot leave it out. The reliable way is the method the add-on uses: add up the stock and the reservations directly on the tables, and subtract one from the other.
This query returns the same value as the Get Free Stock button with the Shipping quality option set to Released, and as the PMX Free Stock column of the Item Master Data.
DECLARE @ItemCode nvarchar(50) = '160731'; DECLARE @SboWhsCode nvarchar(8) = '01'; SELECT ISNULL(inv."Quantity", 0) - ISNULL(lck."Quantity", 0) AS "FreeStock", ISNULL(inv."Quantity", 0) AS "InventoryQuantity", ISNULL(lck."Quantity", 0) AS "LockedQuantity" FROM ( SELECT SUM(PMX_INVT."Quantity") AS "Quantity" FROM PMX_INVT INNER JOIN PMX_OSEL ON PMX_OSEL."Code" = PMX_INVT."StorLocCode" INNER JOIN PMX_OSWH ON PMX_OSWH."Code" = PMX_OSEL."PmxWhsCode" WHERE PMX_INVT."ItemCode" = @ItemCode AND PMX_OSWH."SboWhsCode" = @SboWhsCode AND PMX_INVT."QualityStatusCode" IN (SELECT "Code" FROM PMX_QYST WHERE "CanBeShipped" = 'Y') AND ISNULL(PMX_INVT."StorLocCode", '') NOT IN (SELECT "Code" FROM PMX_DISALLOWED_LOCATIONS_FOR_PICKING WHERE "Code" IS NOT NULL) ) AS inv CROSS JOIN ( SELECT SUM(PMX_INLD."Quantity") AS "Quantity" FROM PMX_INLD INNER JOIN PMX_OSWH ON PMX_OSWH."Code" = PMX_INLD."PmxWhsCode" WHERE PMX_INLD."ItemCode" = @ItemCode AND PMX_OSWH."SboWhsCode" = @SboWhsCode AND PMX_INLD."QualityStatusCode" IN (SELECT "Code" FROM PMX_QYST WHERE "CanBeShipped" = 'Y') AND ISNULL(PMX_INLD."StorLocCode", '') NOT IN (SELECT "Code" FROM PMX_DISALLOWED_LOCATIONS_FOR_PICKING WHERE "Code" IS NOT NULL) ) AS lck;
How to adjust the query:
lck) only, because the Item Master Data does not filter reservations by quality status. The result can then be lower than the value of the Get Free Stock button."CanBeShipped" = 'Y' OR "CanBeShippedUnderQuarantine" = 'Y' in both parts.When users compare a query that adds up the free quantities of the rows, the Get Free Stock button and the Free stock screen for the same item, they usually see three different numbers. Each number answers a different question. None of them is wrong, they only look like the same number.
| Query that adds up ActualFreeQuantity | Get Free Stock button / Item Master Data | Free stock screen (delivery) | |
|---|---|---|---|
| Question it answers | None, the total has no real meaning | How much of this item in this SAP warehouse is not reserved by anyone? | Which logistic units and locations can users take from, and how much from each, without breaking a reservation? |
| Result | The free quantities of all rows added up | One number per item and SAP warehouse | One row per logistic unit and location. When 'OK' is pressed, the total is limited to the free stock of the item. |
| Calculated from | The free stock view | The stock minus the reservations | The free stock view |
| Item, batch and logistic unit reservations | Counted once for every row, so the total is too high | Counted once | Shown on every row, but only applied once when 'OK' is pressed |
| Quality statuses | Depends on the query (in the example above: can be shipped, can be shipped under quarantine and can be used for production) | • Button: based on the Shipping quality option of the line (Released: can be shipped) • Item Master Data: stock that can be shipped, reservations of all statuses | Can be shipped, or can be shipped under quarantine |
| Disallowed locations | Left out, if the query filters on them | Left out of both stock and reservations | Left out |
| Warehouse | Produmex warehouse, if the query filters on it | SAP warehouse | SAP warehouse |
| Rows without free stock | Included. Negative rows lower the total. | Not applicable | Hidden |
| Reservations of the sales order itself | Subtracted | Subtracted | Subtracted |
The most common reasons why the numbers differ on live data:
The Free stock screen itself can also be misleading: the rows show the free quantity per row, and together they can add up to more than users can actually select. The screen only shows this when users press 'OK'.
Which free stock number to use depends on the question users want to answer:
| Question | Where to look |
|---|---|
| How much of this item is free in the warehouse? | The Get Free Stock button on the sales order, or the PMX Free Stock column in the Item Master Data. For a report, use the query in Correct query above. |
| Which logistic units and locations can stock be taken from? | The free stock view (PMX_FREE_STOCK). It shows the free quantity of each logistic unit on each location. The Free stock screen shows the same values, but only the rows with free stock. |
| What will WMS actually pick? | The pick list proposal. Only picking uses all the picking rules. |
Free stock in a report
Free stock per logistic unit or location
The free stock view (PMX_FREE_STOCK) is the right source to see where the free stock is, and where a reservation applies, because it lists every logistic unit on every location. The Free stock screen shows the same values, but hides the rows without free stock. The free quantity on each row is only valid for that row. It shows how much users can take from that logistic unit, not how much is free in total.
What WMS will actually pick
Neither the Free stock screen nor the Get Free Stock button shows exactly what WMS will pick.
Picking also takes into account:
When a customer asks why a pick list proposal has a different quantity, the debug log of the add-on can help. It contains the exact calculation that WMS used.