Sub topic 4
How business partner data is stored
This chapter assumes you know the business partner as the leading master data object. It also assumes you know the categories (person, organization, group) and that roles turn a partner into a customer or supplier. The next question is where the data physically sits. You need the answer when you write reports, debug CVI, or read data through an API.
The storage model in one view
Business partner data follows one idea. A small central header holds what is true for every partner. Separate tables hold repeating or optional data such as addresses, roles, bank accounts and identification numbers. Customer and supplier tables are separate from all of this and are kept in step by CVI (Customer/Vendor Integration).
The header table BUT000
BUT000 holds one row per business partner. These fields matter most:
| Field | Meaning |
|---|---|
| PARTNER | The business partner number, which users see |
| PARTNER_GUID | A 16-byte technical key that never changes. CVI links use it |
| TYPE | Category: 1 person, 2 organization, 3 group |
| BU_GROUP | The grouping, which controls the number range and field control |
| NAME_ORG1 to NAME_ORG4 | Name fields for organizations |
| NAME_LAST, NAME_FIRST | Name fields for persons |
| BU_SORT1, BU_SORT2 | Search terms |
| XBLCK, XDELE | Central block and central deletion flags |
The partner number is what people type. The GUID is what programs should join on when they connect partner data to other objects. The number can be external, and the grouping decides that. The GUID is always assigned by the system.
BUT000 stores only data that is the same for every role. If a field depends on whether the partner is a customer, it does not belong in this table.
Satellite tables
Each satellite table holds one kind of data and is keyed by the partner number. Some of them also use a second key, such as an address number or a role type.
| Table | Content | Cardinality per partner |
|---|---|---|
| BUT100 | Roles assigned (field RLTYP) | Many |
| BUT020 | Link from the partner to address numbers | Many |
| ADRC | The address itself (street, city, country) | Many, via BUT020 |
| BUT0ID | Identification numbers such as a commercial register number | Many |
| BUT0BANK | Bank details | Many |
| BUT050 | Relationships between partners | Many |
| DFKKBPTAXNUM | Tax numbers | Many |
Three of these deserve more explanation.
Addresses: BUT020 and ADRC
The partner does not store its address directly. BUT020 maps the partner to an address number (ADDRNUMBER). The central address management table ADRC holds the address text fields under that number. Other SAP objects use the same address management. This design lets one partner have several addresses, and the standard address is flagged with XDFADR in BUT020.
ADRC rows are versioned. A row is identified by address number, validity start date and nation. Nation is blank for the standard version of an address, and a non-blank value stores an international version, for example a local-script spelling. A query that ignores this may return duplicates.
Roles: BUT100
Each row in BUT100 states that the partner holds one role, for example FLCU00 (FI customer) or FLVN00 (FI vendor). The row is a marker. It does not hold the customer data itself. The role decides which tabs and fields appear in transaction BP. Chapter 5 covers roles in detail.
Bank details and identification
Bank details sit in BUT0BANK, keyed by partner and a bank detail ID. Classic customer and supplier bank tables (KNBK and LFBK) are filled from it through CVI. Maintain the bank data on the partner and treat the classic tables as a copy.
Role-specific data lives in the classic tables
Data that depends on an organizational unit is not in the BUT tables. It is in the classic customer and supplier tables:
| Level | Customer | Supplier |
|---|---|---|
| General | KNA1 | LFA1 |
| Company code | KNB1 | LFB1 |
| Sales area / purchasing organization | KNVV | LFM1 |
CVI creates and updates these rows when a partner with a customer or supplier role is saved. The link tables CVICUSTLINK and CVIVENDLINK connect them to the partner by PARTNER_GUID. The two link tables are the only reliable way to go from a partner number to a customer or supplier number and back.
Reading the model with a query
This ABAP report reads organization partners with their standard address. It uses the header, the address link and the address table, and it respects the XDFADR and nation rules described above.
REPORT z_bp_storage_demo.
SELECT b~partner,
b~name_org1,
a~city1,
a~country
FROM but000 AS b
INNER JOIN but020 AS l
ON l~partner = b~partner
INNER JOIN adrc AS a
ON a~addrnumber = l~addrnumber
WHERE b~type = '2'
AND l~xdfadr = 'X'
AND a~nation = @space
INTO TABLE @DATA(lt_partners)
UP TO 10 ROWS.
cl_demo_output=>display( lt_partners ).Without the XDFADR condition, a partner with three addresses appears three times. Without the nation condition, it can appear again for each international version.
How the API maps to the tables
The released OData service APIBUSINESSPARTNER hides the table layout. Each entity set corresponds to a storage area:
| Entity set | Storage area |
|---|---|
| A_BusinessPartner | BUT000 plus the Customer and Supplier keys from the CVI links |
| A_BusinessPartnerAddress | BUT020 and ADRC |
| A_BusinessPartnerRole | BUT100 |
| A_BusinessPartnerBank | BUT0BANK |
| A_BusinessPartnerTaxNumber | Tax number table |
| A_Customer, A_Supplier | KNA1 and LFA1, with their sub-levels |
Use the API in preference to direct table reads when you build integrations. The API goes through the business logic, and a direct table write skips validation and CVI. A direct write can therefore leave the BUT tables and the classic tables inconsistent.
Failure modes and edge cases
- Partner without a customer row. A partner can exist with a role such as FLCU00 and still have no row in CVICUSTLINK if synchronization failed. A join like the one in the topic example then returns nothing for that partner. The partner looks like a customer in BUT100 but cannot be used in sales documents.
- Customer row without a partner. After incomplete migrations, KNA1 rows may exist with no link. Postings against them are blocked in S/4HANA.
- Duplicate rows from joins. Joining ADRC, BUT0ID or BUT0BANK without the right key conditions multiplies rows.
- Two numbers for the same thing. The partner number and the customer number are stored in different fields. Reports that filter on one and display the other need the link table.
- Deletion. The central flag XDELE in BUT000 marks the partner for deletion. It does not remove the classic rows. Archiving is a separate process.
Exercise
A report joins BUT000 to CVICUSTLINK on PARTNER = CUSTOMER and returns almost no rows, although many customers exist. What is wrong, and what should the join condition be?
Show answer
The join uses the partner number and the customer number, which are separate keys and are not guaranteed to be equal. The link table connects the two objects through the technical key. The condition should be c~partnerguid = b~partnerguid, which then gives the customer number in c~customer.
Exercise
A query over BUT000, BUT020 and ADRC returns three rows for one partner that has a single address on screen. Name two conditions that can remove the extra rows.
Show answer
Restrict BUT020 to the standard address with XDFADR = 'X', and restrict ADRC to the standard version with NATION = space. Checking address validity dates also helps if several time versions exist.