Open sales orders with open quantity
Every open sales order line that still has quantity to deliver.
Tool
SELECT T0.DocNum, T0.DocDate, T0.DocDueDate, T0.CardCode, T0.CardName, T1.ItemCode, T1.Dscription, T1.Quantity, T1.OpenQty, T1.WhsCode FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry WHERE T0.DocStatus = 'O' AND T1.LineStatus = 'O' AND T1.OpenQty > 0 ORDER BY T0.DocDueDate, T0.DocNum
SELECT T0."DocNum", T0."DocDate", T0."DocDueDate", T0."CardCode", T0."CardName", T1."ItemCode", T1."Dscription", T1."Quantity", T1."OpenQty", T1."WhsCode" FROM ORDR T0 INNER JOIN RDR1 T1 ON T0."DocEntry" = T1."DocEntry" WHERE T0."DocStatus" = 'O' AND T1."LineStatus" = 'O' AND T1."OpenQty" > 0 ORDER BY T0."DocDueDate", T0."DocNum"
What this query answers
Every morning the warehouse lead asks what still has to ship and what is already late. This list shows each order line with quantity left to deliver, sorted by the promised delivery date so the oldest promises come first.
Sample output
Illustrative demo values. Your columns are the same; the numbers come from your company.
| DocNum | DocDate | DocDueDate | CardCode | CardName | ItemCode | Dscription | Quantity | OpenQty | WhsCode |
|---|---|---|---|---|---|---|---|---|---|
| 4102 | 2026-10-12 | 2026-10-20 | C20000 | Acme Trading | A00001 | Laser Printer 1420 | 10 | 4 | 01 |
| 4108 | 2026-10-15 | 2026-10-24 | C40000 | Blue Harbor Foods | A00007 | Paper A4 Box | 50 | 50 | 01 |
| 4108 | 2026-10-15 | 2026-10-24 | C40000 | Blue Harbor Foods | A00005 | Toner Cartridge Black | 12 | 6 | 02 |
| 4115 | 2026-10-21 | 2026-10-30 | C30000 | Northwind Retail | A00012 | Wireless Keyboard | 25 | 25 | 01 |
SQL Server vs SAP HANA
No functions change here; the HANA version differs only by double-quoted column names. The status filters 'O' are case-sensitive string literals in both databases, so keep them upper case.
Common errors and fixes
- Lines already delivered still appear: Keep both T0.DocStatus = 'O' and T1.LineStatus = 'O'. A line closed manually has LineStatus 'C' even when the header is still open.
- Dates per line differ from the header due date: DocDueDate is the header delivery date. If your team sets a delivery date per row, select T1.ShipDate and sort by it instead.
Need this report built into SAP Business One?
A saved query answers the question once. We build B2B customer portals for SAP Business One: customers see their prices, stock, order status, invoices and statements, and their orders land in SAP as sales orders. Or hire a remote SAP Business One developer for the whole job, fixed price per phase.
Related queries
Table reference: ORDR table (Sales Order (header)) · RDR1 table (Sales Order (lines))
Three steps, no signup
Copy the right version
Use the SQL Server tab for MS SQL databases and the HANA tab for SAP B1 on HANA.
Open Query Generator
In SAP Business One go to Tools → Queries → Query Generator, paste and click Execute.
Save and share
Click Save, pick a category and give the query a name. Your team can run it from Query Manager.
Questions about this tool
How do I run the open sales orders with open quantity query in SAP Business One?
Copy the version that matches your database, open Tools → Queries → Query Generator, paste it in the SQL box and click Execute. Save it to reuse it later.
Which tables does this query use?
It reads ORDR, RDR1 from the standard SAP Business One schema. No user-defined fields are needed.
Can this be turned into a dashboard or alert?
Yes. We turn queries into Crystal reports, Excel reports that refresh themselves, SAP B1 alerts or WhatsApp messages for managers.
Built for SAP Business One teams
Need this inside SAP Business One?
We build add-ons, reports and integrations for SAP B1 on SQL Server and HANA. Tell us what you need and get a fixed price, usually within 24 hours.
