Managing warehouse information in SAP Business One is an essential part of maintaining accurate inventory and item setup. Whether you’re updating minimum and maximum stock levels or adding new warehouses to an item, the process is handled through the Data Transfer Workbench (DTW).
One important detail: DTW requires the correct LineNum value for each warehouse entry in the ItemWarehouseInfo template. If the LineNum is wrong, your import will fail or overwrite the wrong row. This guide explains how to determine the right LineNum and how to prepare your templates for both updates and new entries.
Step 1: Understand How LineNum Works
In SAP Business One:
- Each warehouse line for an item is stored in the OITW table.
- DTW identifies these lines using the LineNum field.
- The LineNum value is based on the sequence in which warehouses are stored, starting from 0.
For example:
- The first warehouse line = LineNum 0
- The second warehouse line = LineNum 1
- The third warehouse line = LineNum 2
So the LineNum = Warehouse List Number – 1.
Step 2: Get the Correct LineNum Values
Run this query to list all warehouses tied to an item, in the order SAP stores them:
SELECT * FROM OITW WHERE ItemCode = 'TEST' ORDER BY WhsCode;
If you only want active warehouses, use:
SELECT * FROM OITW T0 INNER JOIN OWHS T1 ON T0.WhsCode = T1.WhsCode WHERE T0.ItemCode = 'TEST' AND T1.Inactive = 'N' ORDER BY T0.WhsCode;
This will give you the sequence of warehouses and their LineNum values.
Step 3: Update Existing Warehouses
Example 1: Update All Warehouses
Suppose you want to update MinStock and MaxStock for all warehouses.
- Warehouse 01 → LineNum = 0
- Warehouse 02 → LineNum = 1
- Warehouse 03 → LineNum = 2
Your DTW template should include all rows, each with the correct LineNum.
Example 2: Update One Warehouse Only
If you only want to update Warehouse 03, you still need the correct LineNum from the query. In this example, Warehouse 03 = LineNum 2.
Your DTW template should only include that row:
Step 4: Add a New Warehouse
When adding a new warehouse to an item, you don’t need to list all existing rows—only the new one. DTW will insert it with the next available LineNum.
Example template:
After importing, the item will now display the new warehouse line along with the existing ones.
Step 5: Special Note for Items Without Warehouses
If an item has no warehouses assigned in the OITW table, you must start with LineNum = 0 when adding the first warehouse.
Key take aways:
- Use SQL queries to find the correct LineNum for each warehouse.
- Always remember that DTW LineNum starts at 0.
- When updating existing warehouses, include the correct LineNum values.
- When adding new warehouses, only the new line needs to be in the template.
Following this process ensures your DTW imports run smoothly and your warehouse information stays consistent.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article