ORDN table in SAP Business One (Returns (header))

ORDN is the SAP Business One table that stores the header of every return, the sales document that takes goods back from a customer into stock. Its object type is 16. The rows are in RDN1, joined on DocEntry; a row copied from a delivery has BaseType 15 and BaseEntry = ODLN.DocEntry.

ORDN key fields

FieldWhat it holds
DocEntryInternal key. Joins to RDN1.DocEntry.
DocNumReturn number users see.
DocDatePosting date.
CardCode / CardNameCustomer. Joins to OCRD.CardCode.
NumAtCardCustomer reference number.
DocStatusO = open, C = closed.
CANCELEDY = cancelled, N = not cancelled, C = cancellation.
DocTotal / DocCurDocument total and currency.
CommentsRemarks.
TransIdJournal entry created by the return. Joins to OJDT.TransId.
ObjTypeObject type, 16 = returns.

How ORDN relates to other tables

ORDN is the header and RDN1 holds the rows. A row copied from a delivery has RDN1.BaseType = 15 and BaseEntry = ODLN.DocEntry (234000031 means it came from an A/R return request). When the return is credited, RDN1.TargetType is 14 (A/R credit memo).

Common joins

  • ORDN T0 INNER JOIN RDN1 T1 ON T1.DocEntry = T0.DocEntry (rows)
  • RDN1 T1 LEFT JOIN ODLN T2 ON T2.DocEntry = T1.BaseEntry AND T1.BaseType = 15 (original delivery)
  • RDN1 T1 LEFT JOIN ORIN T3 ON T3.DocEntry = T1.TrgetEntry AND T1.TargetType = 14 (A/R credit memo)

When you use the ORDN table

Use ORDN with RDN1 to report returned quantities per item and customer, to trace each return to its delivery, and to find returns that were not yet credited (open returns).

Example query: returns with the original delivery number, last 90 days

SQL Server

SELECT T0.DocNum AS ReturnNum, T0.DocDate, T0.CardCode, T1.ItemCode, T1.Quantity,
  T2.DocNum AS DeliveryNum
FROM ORDN T0
INNER JOIN RDN1 T1 ON T1.DocEntry = T0.DocEntry
LEFT JOIN ODLN T2 ON T2.DocEntry = T1.BaseEntry AND T1.BaseType = 15
WHERE T0.CANCELED = 'N' AND DATEDIFF(day, T0.DocDate, GETDATE()) <= 90
ORDER BY T0.DocDate DESC

SAP HANA (column names in double quotes)

SELECT T0."DocNum" AS "ReturnNum", T0."DocDate", T0."CardCode", T1."ItemCode", T1."Quantity",
  T2."DocNum" AS "DeliveryNum"
FROM ORDN T0
INNER JOIN RDN1 T1 ON T1."DocEntry" = T0."DocEntry"
LEFT JOIN ODLN T2 ON T2."DocEntry" = T1."BaseEntry" AND T1."BaseType" = 15
WHERE T0."CANCELED" = 'N' AND DAYS_BETWEEN(T0."DocDate", CURRENT_TIMESTAMP) <= 90
ORDER BY T0."DocDate" DESC

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

Common pitfall: Confusing a return with a credit memo

ORDN (object 16) brings goods back into stock; the A/R credit memo (ORIN, object 14) reduces what the customer owes. A sales report net of returns should subtract credit memos, not returns, or a returned item that was credited is counted twice. See ORIN table (A/R credit memo).

Ready-made queries that use ORDN

Questions about the ORDN table

What is the object type of a return in SAP B1?

16. It is the default of ORDN.ObjType.

How do I find the delivery a return came from?

RDN1.BaseType = 15 and RDN1.BaseEntry = ODLN.DocEntry.

What is the difference between ORDN and ORIN?

ORDN is the return (goods back into stock, object 16); ORIN is the A/R credit memo (the financial credit, object 14).

Related tables

ODLN (Delivery (header)) · ORIN (A/R Credit Memo (header)) · 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.