ORDR table in SAP Business One (Sales Order (header))

ORDR is the SAP Business One table that stores the header of every sales order: customer, dates, totals and status. Its lines are in RDR1, joined on DocEntry, and its object type is 17.

ORDR key fields

FieldWhat it holds
DocEntryInternal key. Joins to RDR1.DocEntry.
DocNumOrder number users see.
DocDatePosting date of the order.
DocDueDateDelivery date requested.
CardCodeCustomer. Joins to OCRD.CardCode.
CardNameCustomer name as printed on the order.
DocTotalOrder total including tax.
DiscPrcntHeader discount percent.
DocStatusO = open, C = closed (fully delivered, invoiced or closed manually).
CANCELEDY if the order was cancelled.
SlpCodeSales employee. Joins to OSLP.

How ORDR relates to other tables

ORDR is the header and RDR1 the lines, joined on DocEntry. On the lines, OpenQty is the quantity still to deliver and LineStatus tells you if the line is open. When a delivery or invoice is copied from the order, the target lines store BaseType = 17 and BaseEntry = ORDR.DocEntry.

Common joins

  • ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry (lines)
  • ORDR T0 INNER JOIN OCRD T2 ON T0.CardCode = T2.CardCode (customer)
  • INV1 T3 ON T3.BaseType = 17 AND T3.BaseEntry = T1.DocEntry AND T3.BaseLine = T1.LineNum (invoices from the order)

When you use the ORDR table

Use ORDR and RDR1 for backorder lists, dispatch planning, order intake per period and committed stock checks. For "what still has to ship", work on the lines (RDR1.OpenQty) rather than the header status, because one order can be partly delivered.

Example query: open sales order lines with open quantity

SQL Server

SELECT T0.DocNum, 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

SAP HANA (column names in double quotes)

SELECT T0."DocNum", 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"

Paste either version in Tools → Queries → Query Generator. Need the other dialect for your own query? Use the SQL to HANA converter.

Common pitfall: Header status is not enough for partial deliveries

An order stays DocStatus = 'O' while any line is open, so a header-only report shows the full order as pending. Use RDR1.LineStatus and OpenQty to see what is really left to deliver. See Open sales orders query.

Ready-made queries that use ORDR

Related tables

OINV (A/R Invoice (header)) · OITW (Item stock per warehouse) · OCRD (Business Partners) · 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.