ODRF table in SAP Business One (Draft Documents (header))
ODRF is the SAP Business One table that stores the header of every draft document: invoices, deliveries, receipts and other documents saved as draft or waiting for approval. ODRF.ObjType tells which document the draft will become (for example 13 = A/R invoice). The rows are in DRF1, joined on DocEntry.
ODRF key fields
| Field | What it holds |
|---|---|
DocEntry | Internal key of the draft. Joins to DRF1.DocEntry. |
ObjType | Type of the document the draft is for, for example 13 = A/R invoice, 15 = delivery, 14 = A/R credit memo. |
DocNum | Document number. |
DocDate | Posting date. |
CardCode / CardName | Business partner. Joins to OCRD.CardCode. |
DocStatus | O = open, C = closed. |
WddStatus | Authorization status: - = without, W = pending, Y = approved, N = rejected, P = generated, A = generated by authorizer, C = cancelled. |
DocTotal / DocCur | Document total and currency. |
UserSign | User who created the draft. Joins to OUSR. |
CreateDate | Creation date. |
How ODRF relates to other tables
ODRF is one shared header table for drafts of many document types; ObjType separates them. DRF1 holds the rows. A real document posted from a draft keeps the link in its own draftKey column (for example OPDN.draftKey = ODRF.DocEntry).
Common joins
ODRF T0 INNER JOIN DRF1 T1 ON T1.DocEntry = T0.DocEntry (rows)ODRF T0 LEFT JOIN OCRD T2 ON T2.CardCode = T0.CardCode (business partner)OPDN T3 INNER JOIN ODRF T0 ON T0.DocEntry = T3.draftKey (goods receipt PO posted from the draft)
When you use the ODRF table
Use ODRF to list open drafts by document type and user, to find documents waiting for approval (WddStatus W), and to clean up old drafts that were never posted.
Example query: open drafts by document type with approval status
SQL Server
SELECT T0.DocEntry, T0.ObjType, T0.DocDate, T0.CardCode, T0.CardName, T0.DocTotal, T0.WddStatus, T0.UserSign, DATEDIFF(day, T0.CreateDate, GETDATE()) AS DaysOld FROM ODRF T0 WHERE T0.DocStatus = 'O' ORDER BY T0.ObjType, T0.CreateDate
SAP HANA (column names in double quotes)
SELECT T0."DocEntry", T0."ObjType", T0."DocDate", T0."CardCode", T0."CardName", T0."DocTotal", T0."WddStatus", T0."UserSign", DAYS_BETWEEN(T0."CreateDate", CURRENT_TIMESTAMP) AS "DaysOld" FROM ODRF T0 WHERE T0."DocStatus" = 'O' ORDER BY T0."ObjType", T0."CreateDate"
Paste either version in Tools → Queries → Query Generator. Need the other dialect for your own query? Use the SQL to HANA converter.
Common pitfall: Reporting drafts as posted documents
Drafts of every type sit in ODRF, so a report must filter ObjType for the document it means, and drafts must never be added to sales or purchase totals. Use the draft DocEntry (not DocNum) to link it to the posted document through draftKey. See Pending approvals query.
Ready-made queries that use ODRF
- Documents waiting for approval: Approval requests still pending, with the document type, originator and age in days.
- Invoices created per user today: How many A/R invoices each SAP B1 user created today, with the total value.
Questions about the ODRF table
Where are draft documents stored in SAP Business One?
In ODRF (header) and DRF1 (rows), for every document type. ODRF.ObjType tells which type the draft is.
How do I find drafts waiting for approval?
Filter ODRF.WddStatus = 'W' (pending).
How do I find the document posted from a draft?
The posted document has draftKey = ODRF.DocEntry.
Related tables
DRF1 (Draft Documents (rows)) · OINV (A/R Invoice (header)) · ORDR (Sales Order (header)) · 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.
