Sub topic 8
Customer/Vendor Integration: linking partners to customers and suppliers
This chapter assumes you know the business partner model from the earlier chapters: categories, roles, groupings and the BUT000 header table. It also assumes you know the classic customer tables (KNA1, KNB1, KNVV) and supplier tables (LFA1, LFB1, LFM1).
Why CVI exists
In SAP S/4HANA you maintain the business partner. Sales, purchasing and finance processes still read customer and supplier records, so those records must exist. Customer/Vendor Integration (CVI) is the synchronization layer that creates and updates them from the business partner data.
You never maintain the customer or supplier directly. You maintain the partner, and CVI writes the classic records.
How the link works
CVI keeps two link tables. Each row joins the internal partner key (PARTNER_GUID) of a BUT000 row to a customer or supplier number.
CVI_CUST_LINKlinks a partner to a customer (KNA1).CVI_VEND_LINKlinks a partner to a supplier (LFA1).
The link uses the GUID, not the visible partner number. The customer or supplier number is often the same as the partner number, but only if the number ranges are set up that way.
What triggers synchronization
The roles on the partner decide what CVI does. A partner with only a general role such as 000000 has no customer or supplier record. When you add a customer role (for example FLCU00, the FI customer role), CVI creates the customer on save. A supplier role such as FLVN00 creates the supplier.
The partner and the classic record are saved together. If CVI fails, the save is rolled back, so you don't get a partner without its customer.
Seeing the link in data
The following query lists the customer number that belongs to each organization partner.
SELECT b~partner, c~customer
FROM but000 AS b
INNER JOIN cvi_cust_link AS c
ON c~partner_guid = b~partner_guid
WHERE b~type = '2'
INTO TABLE @DATA(lt_customers)
UP TO 10 ROWS.The same pattern with CVI_VEND_LINK returns suppliers. A partner missing from the result has no customer role, or its synchronization failed.
The released OData service API_BUSINESS_PARTNER exposes the result of CVI as the Customer and Supplier fields of A_BusinessPartner:
GET /sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner?$filter=BusinessPartnerCategory eq '2'&$select=BusinessPartner,BusinessPartnerFullName,BusinessPartnerGrouping,Customer,Supplier&$top=5
Accept: application/jsonAn empty Customer or Supplier value means CVI has not created that record for the partner.
What CVI depends on
CVI needs three settings from the business partner configuration, which a later chapter covers.
- Role mapping: which BP roles create a customer or supplier.
- Number assignment: how the partner number relates to the customer or supplier number, which is tied to the grouping.
- Field mapping: how BP fields map to fields in the classic tables.
Exercise
A new partner exists in BUT000, but a query on CVICUSTLINK returns no row for it. Give two possible reasons.
Show answer
The partner has no customer role (for example only the general role 000000), so CVI never created a customer. Or the synchronization failed, for example because of a number range or role mapping problem. In the second case the save should have been rolled back, so also check whether the partner was created before CVI was configured.