OCPR table in SAP Business One (Contact Persons)
OCPR is the SAP Business One table that stores the contact persons of business partners: one row per contact, keyed by CntctCode and linked to OCRD by CardCode. It holds the name, position, phones and e-mail. The default contact of a partner is named in OCRD.CntctPrsn.
What is the OCPR table in SAP B1?
OCPR is the SAP Business One contact persons table. Each row is one contact of a customer, vendor or lead, with name, position, phone numbers and e-mail. CntctCode is the internal key that documents store, CardCode links the contact to OCRD, and OCRD.CntctPrsn names the default contact of the partner.
Where is the OCPR table in SAP B1?
In SAP Business One 10.0, OCPR is the "Contact Persons" table with 57 columns. You see its data in Business Partners → Business Partner Master Data (header table OCRD).
| Table | OCPR Contact Persons (child of OCRD) |
|---|---|
| Object type (ObjType) | 2 (oBusinessPartners), the object type of OCRD |
| Menu path | Business Partners → Business Partner Master Data |
| DI API object | BusinessPartners |
| Service Layer entity | BusinessPartners (request builder) |
| Columns | 57 in SAP B1 10.0 (SDK database tables reference) |
OCPR key fields
| Field | SAP type | What it holds |
|---|---|---|
CntctCode | Int(11) | Internal key of the contact. Documents store it, for example OINV.CntctCode. |
CardCode | nVarChar(15) | Business partner. Joins to OCRD.CardCode. |
Name | nVarChar(50) | Contact ID shown in the business partner window. OCRD.CntctPrsn holds this value for the default contact. |
FirstName / MiddleName / LastName | nVarChar(50) | First, middle and last name. |
Title | nVarChar(10) | Title of the person. |
Position | nVarChar(90) | Job position. |
Tel1 / Tel2 | nVarChar(50) | Phone numbers. |
Cellolar | nVarChar(50) | Mobile phone (SAP spelling). |
E_MailL | nVarChar(100) | E-mail address (SAP spelling, with a double L). |
Address | nVarChar(254) | Address text of the contact. |
Active | VarChar(1) | Y = active contact, N = inactive. |
BirthDate | Date | Date of birth. |
Types as listed in the SAP Business One 10.0 SDK database tables reference: nVarChar(n) is text of up to n characters, Num(19,6) a decimal with 6 places. Column names are the same on SQL Server and SAP HANA.
How OCPR relates to other tables
OCPR is a child table of OCRD: every contact belongs to one business partner through CardCode, and a partner can have many contacts. OCRD.CntctPrsn stores the Name of the default contact, not its CntctCode. Marketing documents store the contact chosen on the document as CntctCode on their header.
Common joins
OCPR T1 INNER JOIN OCRD T0 ON T0.CardCode = T1.CardCode (business partner)OCRD T0 LEFT JOIN OCPR T1 ON T1.CardCode = T0.CardCode AND T1.Name = T0.CntctPrsn (default contact)OINV T2 LEFT JOIN OCPR T1 ON T1.CntctCode = T2.CntctCode (contact on an A/R invoice)
When you use the OCPR table
Use OCPR for contact and e-mail lists per customer or vendor, for document layouts that print the contact name and phone, for dunning and statement e-mails, and to find partners with no contact or no e-mail address.
Example query: customers with their default contact, phone and e-mail
SQL Server
SELECT T0.CardCode, T0.CardName, T1.Name, T1.FirstName, T1.LastName, T1.Position, T1.Tel1, T1.Cellolar, T1.E_MailL FROM OCRD T0 LEFT JOIN OCPR T1 ON T1.CardCode = T0.CardCode AND T1.Name = T0.CntctPrsn WHERE T0.CardType = 'C' ORDER BY T0.CardCode
SAP HANA (column names in double quotes)
SELECT T0."CardCode", T0."CardName", T1."Name", T1."FirstName", T1."LastName", T1."Position", T1."Tel1", T1."Cellolar", T1."E_MailL" FROM OCRD T0 LEFT JOIN OCPR T1 ON T1."CardCode" = T0."CardCode" AND T1."Name" = T0."CntctPrsn" WHERE T0."CardType" = 'C' ORDER BY T0."CardCode"
Paste either version in Tools → Queries → Query Generator. Need the other dialect for your own query? Use the SQL to HANA converter.
Common pitfall: Column names that are not what you type first
The e-mail column is E_MailL with a double L and the mobile column is Cellolar; E_Mail on OCRD is the company e-mail, not the contact one. The second trap is the default contact: OCRD.CntctPrsn holds the contact Name, so join it to OCPR.Name together with CardCode, not to CntctCode. See OCRD table (business partners).
Ready-made queries that use OCPR
- Business partners missing a tax ID: Active customers and vendors with no federal tax ID (VAT / RUC / NIT / NTN).
- Customer balances: All customers with a non-zero account balance, with credit limit and phone.
Building something on OCPR?
Reading OCPR (Contact Persons) in a query is the easy part. We build SAP Business One customer portals: customers see their prices, stock, order status, invoices and statements, and their orders land in SAP as sales orders. Or hire a remote SAP Business One developer for the whole job, fixed price per phase.
Questions about the OCPR table
What is the OCPR table in SAP B1?
OCPR is the SAP Business One contact persons table. Each row is one contact of a customer, vendor or lead, with name, position, phone numbers and e-mail. CntctCode is the internal key that documents store, CardCode links the contact to OCRD, and OCRD.CntctPrsn names the default contact of the partner.
How do I join OCPR to OCRD in SAP B1?
Join on OCPR.CardCode = OCRD.CardCode to list every contact. For the default contact only, add OCPR.Name = OCRD.CntctPrsn.
Which column holds the contact e-mail in SAP B1?
OCPR.E_MailL (with a double L). OCRD.E_Mail is the e-mail of the business partner itself.
How do I show the contact person of an A/R invoice?
The invoice header stores the contact key: join OCPR on OCPR.CntctCode = OINV.CntctCode and read Name, Tel1 and E_MailL.
What is the key of the OCPR table?
CntctCode, an internal number. Name is the contact ID users see and is what OCRD.CntctPrsn stores for the default contact.
Related tables
OCRD (Business Partners) · CRD1 (Business Partner Addresses) · OINV (A/R Invoice (header)) · search all SAP Business One tables
Sources: SAP Business One documentation and SDK (DI API database tables reference), SAP Help Portal; SDK 10.0 table page for OCPR.
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.
