OITW table in SAP Business One (Item stock per warehouse)

OITW is the SAP Business One table that holds the stock of each item in each warehouse: on hand, committed to sales orders and ordered from vendors. Its key is ItemCode plus WhsCode, and it joins to OITM on ItemCode and to OWHS on WhsCode.

OITW key fields

FieldWhat it holds
ItemCodeItem. Joins to OITM.ItemCode.
WhsCodeWarehouse. Joins to OWHS.WhsCode.
OnHandPhysical stock in this warehouse.
IsCommitedQuantity committed to open sales orders in this warehouse.
OnOrderQuantity on open purchase orders for this warehouse.
MinStockMinimum stock level for this item in this warehouse.
AvgPriceItem cost in this warehouse when costs are managed per warehouse.
LockedY if the item is locked in this warehouse.

How OITW relates to other tables

OITW is a child of OITM: one item has one OITW row for each warehouse it is linked to, even when the stock is zero. It is not a document line table, so there is no DocEntry; the pair ItemCode + WhsCode identifies a row. Bin locations, when active, add another level in OIBQ and OBIN.

Common joins

  • OITW T0 INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode (item name, group)
  • OITW T0 INNER JOIN OWHS T2 ON T0.WhsCode = T2.WhsCode (warehouse name)

When you use the OITW table

Read OITW whenever the question is "how much of this item is in that warehouse": availability for sales, stock lists per branch, reorder by warehouse and stock valuation by warehouse. Available stock is usually OnHand - IsCommited + OnOrder, or OnHand - IsCommited if you do not count open purchase orders.

Example query: available stock per item and warehouse

SQL Server

SELECT T0.ItemCode, T1.ItemName, T0.WhsCode, T2.WhsName, T0.OnHand,
  T0.IsCommited, T0.OnOrder, T0.OnHand - T0.IsCommited + T0.OnOrder AS Available
FROM OITW T0
INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode
INNER JOIN OWHS T2 ON T0.WhsCode = T2.WhsCode
WHERE T0.OnHand <> 0 OR T0.IsCommited <> 0
ORDER BY T0.ItemCode, T0.WhsCode

SAP HANA (column names in double quotes)

SELECT T0."ItemCode", T1."ItemName", T0."WhsCode", T2."WhsName", T0."OnHand",
  T0."IsCommited", T0."OnOrder", T0."OnHand" - T0."IsCommited" + T0."OnOrder" AS "Available"
FROM OITW T0
INNER JOIN OITM T1 ON T0."ItemCode" = T1."ItemCode"
INNER JOIN OWHS T2 ON T0."WhsCode" = T2."WhsCode"
WHERE T0."OnHand" <> 0 OR T0."IsCommited" <> 0
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: IsCommited, one t, and rows with zero stock

The committed column is spelled IsCommited, so IsCommitted gives an "invalid column" error. OITW also keeps a row for every linked warehouse even with zero stock, so filter OnHand <> 0 (or OnHand, IsCommited and OnOrder) to keep the list short. See Stock by warehouse query with variations.

Ready-made queries that use OITW

Related tables

OITM (Items (item master data)) · ORDR (Sales Order (header)) · INV1 (A/R Invoice (lines)) · 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.