OSRQ table in SAP Business One (Serial Number Quantities (per warehouse))
OSRQ is the SAP Business One table that holds the quantity of each serial number per warehouse: one row per serial and warehouse, with Quantity, CommitQty and CountQty. It points to the serial master OSRN through MdAbsEntry (or ItemCode plus SysNumber) and to the warehouse through WhsCode.
OSRQ key fields
| Field | What it holds |
|---|---|
AbsEntry | Internal key of the row. |
MdAbsEntry | Serial master key. Joins to OSRN.AbsEntry. |
ItemCode | Item. Joins to OITM.ItemCode. |
SysNumber | System number of the serial. With ItemCode it joins to OSRN. |
WhsCode | Warehouse. Joins to OWHS.WhsCode. |
Quantity | Quantity in the warehouse. |
CommitQty | Committed quantity. |
CountQty | Counted quantity. |
How OSRQ relates to other tables
OSRQ is the quantity layer under OSRN. Each serial in OSRN can have rows in OSRQ for the warehouses it has been in. Join OSRQ.MdAbsEntry = OSRN.AbsEntry to get the serial number, and OSRQ.WhsCode = OWHS.WhsCode to get the warehouse name.
Common joins
OSRQ T0 INNER JOIN OSRN T1 ON T1.AbsEntry = T0.MdAbsEntry (serial number)OSRQ T0 INNER JOIN OWHS T2 ON T2.WhsCode = T0.WhsCode (warehouse)OSRQ T0 INNER JOIN OITM T3 ON T3.ItemCode = T0.ItemCode (item master)
When you use the OSRQ table
Use OSRQ to count serials in stock per item and warehouse, to compare that count with the stock quantity of the item, and to find committed serials before a stock count.
Example query: serials in stock and committed per item and warehouse
SQL Server
SELECT T0.ItemCode, T3.ItemName, T0.WhsCode, SUM(T0.Quantity) AS InStock, SUM(T0.CommitQty) AS Committed FROM OSRQ T0 INNER JOIN OITM T3 ON T3.ItemCode = T0.ItemCode WHERE T0.Quantity > 0 GROUP BY T0.ItemCode, T3.ItemName, T0.WhsCode ORDER BY T0.ItemCode, T0.WhsCode
SAP HANA (column names in double quotes)
SELECT T0."ItemCode", T3."ItemName", T0."WhsCode", SUM(T0."Quantity") AS "InStock", SUM(T0."CommitQty") AS "Committed" FROM OSRQ T0 INNER JOIN OITM T3 ON T3."ItemCode" = T0."ItemCode" WHERE T0."Quantity" > 0 GROUP BY T0."ItemCode", T3."ItemName", T0."WhsCode" ORDER BY T0."ItemCode", T0."WhsCode"
Paste either version in Tools → Queries → Query Generator. Need the other dialect for your own query? Use the SQL to HANA converter.
Common pitfall: Rows with Quantity 0 are not stock
OSRQ can hold rows with Quantity 0, so filter Quantity > 0 for stock reports. When you join OSRN, use MdAbsEntry or ItemCode plus SysNumber; ItemCode alone multiplies the rows. See OSRN table (serial numbers).
Ready-made queries that use OSRQ
- Stock by warehouse: On hand, committed, ordered and available quantity per item and warehouse.
Questions about the OSRQ table
What is the difference between OSRN and OSRQ?
OSRN is the serial master (number, dates, status). OSRQ holds the quantity of each serial per warehouse.
How do I join OSRQ to OSRN?
On OSRQ.MdAbsEntry = OSRN.AbsEntry, or on ItemCode and SysNumber together.
What is CommitQty in OSRQ?
The committed quantity of the serial in that warehouse.
Related tables
OSRN (Serial Numbers (master data)) · OWHS (Warehouses) · OITW (Item stock per warehouse) · search all SAP Business One tables
Sources: SAP Business One documentation and SDK (DI API database tables reference), SAP Help Portal.
Ready to get started?
Tell us what you need. You get a clear technical answer, a fixed scope and a price, usually within 24 hours.
