Sub topic 12
Relationships and contact persons
This chapter assumes you know the business partner categories and roles from earlier chapters and can navigate transaction BP. It also assumes you know what the standard table BUT000 holds. You will learn how SAP links two business partners, how a contact person is modeled, and where that data is stored and synchronized.
Why relationships exist
In the legacy customer master, a contact person was a sub-record of the customer. It had its own screen and table, and it could not exist without that customer. The business partner model changes this. A contact person is a business partner of category Person, and the connection to the company is a separate object called a relationship.
A relationship has these properties:
- It connects exactly two business partners.
- It has a relationship category that defines its meaning, for example "Has contact person".
- It has a validity period.
- It can carry data of its own, such as a function, a department or an address.
Because the person is a business partner in their own right, one person can act as contact for several organizations. Their name and personal data are stored once.
Relationship categories
The relationship category defines what the link means. It also decides which data screens are available for it. Standard SAP delivers many categories, such as "Has contact person", "Is shareholder of" and "Is married to". Customizing lets you add your own.
The category "Has contact person" (technical key BUR001) is the one you use most in customer and supplier scenarios. Other categories are mostly used in special industry scenarios.
| Aspect | Relationship category | Business partner role |
|---|---|---|
| What it describes | A link between two partners | A function of one partner |
| Example | Contact person of Example Trading GmbH | Customer (FLCU00) |
| Stored with | Both partner numbers and a validity period | The partner and a role code |
| Typical effect | Contact data and screens | Which data screens and CVI objects exist |
How the data is stored
A relationship is not stored in the general data of either partner. It has its own header record, and optional detail records hang from it.
| Table | Content |
|---|---|
| `BUT050` | Relationship header: relationship number, both partners, category, validity dates |
| `BUT051` | Contact person relationship data: function, department, and similar fields |
| `BUT052` | Addresses that belong to the relationship |
In BUT050 for the category "Has contact person", PARTNER1 is the organization and PARTNER2 is the person. Check this against a record in your own system before you rely on it in code. The relationship number RELNR is not a unique key across partner pairs by itself. A pair of partners can have several relationships of different categories, and the same category can appear again with a different validity period.
The diagram shows the key property of the model. The person exists once. Each organization has its own relationship record, and each record has its own function and validity.
Creating a contact person in transaction BP
There are two ways to get a contact person.
Create the relationship from the organization. Open the organization in change mode and go to the Relationships tab. Choose Create Relationship and select the category "Has contact person". Then either pick an existing person partner or create a new one directly from this screen. Fill in the relationship data, for example function and department, and save.
Create the person first. Create a partner of category Person, then open the organization and add the relationship to the existing person.
Note these points:
- The organization must exist before you can relate a person to it.
- The person partner does not need the customer or supplier role. The role belongs to the organization.
- The validity dates default to "today until 31.12.9999". To end a relationship, set the end date. Do not delete the record.
- A contact person can have an address that differs from the organization's address. That address is stored with the relationship in
BUT052, so it applies to that company only.
Relationships versus partner functions
This is a common source of confusion. A relationship in BUT050 is not the same as a partner function such as ship-to party, bill-to party or payer.
- A relationship is a general link between two business partners. It is independent of any sales area.
- A partner function is assigned at sales area level of a customer. It tells a sales document which customer plays which role, and it is stored in the classic table
KNVPafter synchronization.
Both can involve two partners, so the two get mixed up. If you need "this customer ships to that address", you maintain the partner function in the customer's sales area data. A relationship of category "Has contact person" will not help there.
Synchronization through CVI
Sales and purchasing documents still read classic customer and supplier data. For contact persons, CVI therefore transfers the relevant relationship data to the classic contact person structures, for example table KNVK. This happens when the organization partner has the customer or supplier role and CVI is active. Two things follow from this:
- A contact person on an organization without a customer or supplier role is stored in the business partner tables only. It has no classic counterpart, and none is needed.
- If CVI synchronization for the organization fails, the contact person data may be saved in the business partner tables but missing in the classic ones. The chapter on troubleshooting covers how to find such cases.
Relationship categories and the mapping of contact person fields are part of the CVI and business partner customizing. Check your system's settings before you assume that a field, for example the contact's function, reaches the classic table.
Reading contact persons through the table
This report lists current contact person relationships for organization partners. It reads the relationship header and resolves nothing else, so it stays simple:
REPORT z_bp_contacts_demo.
SELECT relnr, partner1, partner2, date_from, date_to
FROM but050
WHERE reltyp = 'BUR001'
AND date_from <= @sy-datum
AND date_to >= @sy-datum
ORDER BY partner1, partner2
INTO TABLE @DATA(lt_contacts)
UP TO 20 ROWS.
LOOP AT lt_contacts INTO DATA(ls_contact).
WRITE: / ls_contact-partner1, ls_contact-partner2,
ls_contact-date_from, ls_contact-date_to.
ENDLOOP.The date conditions matter. Without them the result includes expired relationships, and you will see persons who no longer work for the company. Direct table access suits analysis and one-off checks. For integrations, use the released API.
Reading contact persons through the API
The released API_BUSINESS_PARTNER service exposes contact relationships as a separate entity set. You can read them for one organization:
GET /sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartnerContact?$filter=BusinessPartnerCompany eq '1000123'&$select=RelationshipNumber,BusinessPartnerCompany,BusinessPartnerPerson,ValidityEndDate&$top=10
Accept: application/jsonThe value 1000123 is a placeholder. Use a partner number from your system. The entity set A_BusinessPartnerContact is part of the service's contact model. If your release does not show it, check the service metadata at /sap/opu/odata/sap/API_BUSINESS_PARTNER/$metadata, because property names can differ between releases. To get the person's name, read the partner in BusinessPartnerPerson through A_BusinessPartner in a second request.
Common mistakes
- Treating the contact person as a customer attribute. A search for the person in customer tables finds nothing. Search
BUT000andBUT050. - Duplicate persons. Because the person is a partner, users sometimes create a new person for each company. Search for the person first.
- Reading expired relationships. Always filter on the validity dates.
- Confusing the direction.
PARTNER1andPARTNER2are not symmetric. Verify the direction for each category. - Mixing up relationships and partner functions. Use
KNVPdata for sales roles such as ship-to and payer.
Exercise
A purchasing clerk leaves Sample Logistics AG, but the same person still works as a consultant for Example Trading GmbH. How do you reflect this in the business partner data without losing history?
Show answer
Keep the person business partner. Open the organization Sample Logistics AG, go to the Relationships tab, and set the validity end date of the "Has contact person" relationship to the leaving date. Do not delete the relationship or the person. The relationship with Example Trading GmbH is a separate record in BUT050 and stays unchanged.
Exercise
You need all current contact persons of one organization in a report. Which table do you read, which category do you filter on, and which condition do you add so that former contacts are excluded?
Show answer
Read BUT050. Filter on RELTYP = 'BUR001' and on the organization in PARTNER1. Add DATEFROM <= today and DATETO >= today to exclude relationships that have not started or have ended.