SAP Business One Order Status Query

SQL queries to check sales order status, track fulfillment, and find open orders by customer.

ORDR, RDR1 4 min read

These are sample queries you can run on Manager Boost. Use them as-is, or edit and customize on our platform. Go custom or use our pre-built queries — you're in control.

Key Concepts

DocStatus Field

DocStatus = 'O' means the order is open (not fully delivered/invoiced). DocStatus = 'C' means closed. An order closes when all lines are fully delivered or manually closed.

CANCELED vs Closed

CANCELED = 'Y' means the order was cancelled — different from closed. Cancelled orders were never fulfilled. Always filter CANCELED = 'N' unless you specifically need cancelled orders.

Quantity vs DelivrdQty

On order lines (RDR1), Quantity is what was ordered. DelivrdQty is what's been delivered via delivery notes. The difference is what's still pending fulfillment.

Line Status

Each line also has LineStatus — 'O' for open, 'C' for closed. A line closes when fully delivered or manually closed, even if the header is still open.

Available Fields Reference

ORDR (Order Header)

DocEntry DocNum DocDate DocDueDate CardCode CardName DocTotal DocStatus CANCELED SlpCode

RDR1 (Order Lines)

DocEntry LineNum ItemCode Dscription Quantity DelivrdQty OpenQty Price LineTotal LineStatus WhsCode

Orders for a Customer

All orders for a specific customer with their status. We calculate days since order date to identify aging orders. The CASE statement converts status codes to readable labels.

SQLMS SQL Server
SELECT 
    T0.DocNum,
    T0.DocDate,
    T0.DocDueDate,
    T0.DocTotal,
    CASE T0.DocStatus 
        WHEN 'O' THEN 'Open'
        WHEN 'C' THEN 'Closed'
    END AS Status,
    DATEDIFF(DAY, T0.DocDate, GETDATE()) AS DaysOld
FROM ORDR T0
WHERE T0.CardCode = 'C10000'
  AND T0.CANCELED = 'N'
ORDER BY T0.DocDate DESC
Sample Result
DocNumDocDateDocDueDateDocTotalStatusDaysOld
50012024-01-102024-01-258500.00Open20

All Open Orders

Orders still waiting to be fulfilled across all customers. Filter DocStatus = 'O' for open orders. DATEDIFF shows how old each order is — useful for identifying orders stuck in processing.

SQLMS SQL Server
SELECT 
    T0.DocNum,
    T0.DocDate,
    T0.CardCode,
    T0.CardName,
    T0.DocTotal,
    DATEDIFF(DAY, T0.DocDate, GETDATE()) AS DaysOld
FROM ORDR T0
WHERE T0.DocStatus = 'O'
  AND T0.CANCELED = 'N'
ORDER BY T0.DocDate
Sample Result
DocNumDocDateCardCodeCardNameDocTotalDaysOld
50012024-01-10C10045Acme Corp8500.0020

Order with Line Details

Get a specific order with all its line items and fulfillment status. Quantity - DelivrdQty shows what's still pending. Join on DocEntry — it's the internal key, not DocNum.

SQLMS SQL Server
SELECT 
    T0.DocNum,
    T0.CardName,
    T1.LineNum + 1 AS Line,
    T1.ItemCode,
    T1.Dscription AS ItemName,
    T1.Quantity AS Ordered,
    T1.DelivrdQty AS Delivered,
    T1.Quantity - T1.DelivrdQty AS Remaining,
    T1.LineTotal,
    CASE T1.LineStatus WHEN 'O' THEN 'Open' ELSE 'Closed' END AS LineStatus
FROM ORDR T0
INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry
WHERE T0.DocNum = 12345
  AND T0.CANCELED = 'N'
ORDER BY T1.LineNum
Sample Result
DocNumCardNameLineItemCodeItemNameOrderedDeliveredRemainingLineTotalLineStatus
5001Acme Corp1A00001Widget Pro5030204500.00Open

Note: LineNum starts at 0 in SAP. We add 1 for user-friendly display.

All Unfulfilled Order Lines

Find all pending quantities across all open orders. This is useful for production planning or pick lists. Filter where Quantity > DelivrdQty to get only lines with pending fulfillment.

SQLMS SQL Server
SELECT 
    T0.DocNum,
    T0.CardName,
    T1.ItemCode,
    T1.Dscription AS ItemName,
    T1.Quantity - T1.DelivrdQty AS Pending,
    T1.WhsCode,
    T0.DocDate,
    T0.DocDueDate,
    DATEDIFF(DAY, T0.DocDueDate, GETDATE()) AS DaysPastDue
FROM ORDR T0
INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry
WHERE T0.DocStatus = 'O'
  AND T0.CANCELED = 'N'
  AND T1.Quantity > T1.DelivrdQty
ORDER BY T0.DocDueDate
Sample Result
DocNumCardNameItemCodeItemNamePendingWhsCodeDocDueDateDaysPastDue
5001Acme CorpA00001Widget Pro20012024-01-255

Give your team answers in 3 seconds

No SQL. No training. Just plain English questions via SMS.