OCRD table in SAP Business One (Business Partners)

OCRD is the SAP Business One business partner master table: customers, vendors and leads are all stored here, told apart by CardType. The key is CardCode; addresses are in CRD1 and contact persons in OCPR.

OCRD key fields

FieldWhat it holds
CardCodeBusiness partner key. Used on every document (OINV, ORDR, OPCH…).
CardNameName.
CardTypeC = customer, S = vendor (supplier), L = lead.
GroupCodeBP group. Joins to OCRG.GroupCode.
LicTradNumTax ID: NIT, RUC, VAT number or TRN, used by e-invoicing.
BalanceAccount balance in local currency.
CreditLineCredit limit.
GroupNumPayment terms. Joins to OCTG.GroupNum.
SlpCodeDefault sales employee. Joins to OSLP.
Phone1Main phone number.
E_MailEmail address.
frozenForY if the business partner is inactive (frozen).

How OCRD relates to other tables

OCRD is master data. Child tables use CardCode as the key: CRD1 (addresses, one row per address and type), OCPR (contact persons) and CRD7 (extra tax IDs). Documents copy CardCode and CardName onto their header, so a report can show the name as it was on the document or join OCRD for the current name.

Common joins

  • OCRD T0 LEFT JOIN CRD1 T1 ON T0.CardCode = T1.CardCode (addresses)
  • OCRD T0 LEFT JOIN OCPR T2 ON T0.CardCode = T2.CardCode (contacts)
  • OCRD T0 LEFT JOIN OCRG T3 ON T0.GroupCode = T3.GroupCode (BP group)
  • OCRD T0 LEFT JOIN OCTG T4 ON T0.GroupNum = T4.GroupNum (payment terms)

When you use the OCRD table

OCRD feeds customer lists, credit control, collection calls and e-invoicing checks. Before going live with ZATCA, SRI, FEL, DTE or PINT AE, check that every active customer has a valid LicTradNum, because the tax authority or certifier rejects invoices without one.

Example query: active customers with balance and credit limit

SQL Server

SELECT T0.CardCode, T0.CardName, T0.LicTradNum, T0.Balance, T0.CreditLine,
  T0.Phone1, T0.E_Mail
FROM OCRD T0
WHERE T0.CardType = 'C' AND T0.frozenFor = 'N'
ORDER BY T0.Balance DESC

SAP HANA (column names in double quotes)

SELECT T0."CardCode", T0."CardName", T0."LicTradNum", T0."Balance", T0."CreditLine",
  T0."Phone1", T0."E_Mail"
FROM OCRD T0
WHERE T0."CardType" = 'C' AND T0."frozenFor" = 'N'
ORDER BY T0."Balance" 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: Forgetting CardType

Customers, vendors and leads share OCRD, so a query without CardType = 'C' or 'S' mixes them. Leads (L) have no postings but appear in counts and exports. See Business partners missing a tax ID.

Ready-made queries that use OCRD

Related tables

OINV (A/R Invoice (header)) · ORDR (Sales Order (header)) · OPCH (A/P Invoice (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.