Sub topic 10
Supplier data: general, company code and purchasing organization
This chapter covers where supplier data lives in S/4HANA and which business partner role fills each level. It assumes you know the classic vendor master views, the meaning of company code and purchasing organization, and how CVI links a business partner to a supplier record from the previous chapter. It also assumes you can read basic table joins.
Three levels, one business partner
A supplier record is split by organizational scope, the same way the old vendor master (transactions XK01, MK01) was. In S/4HANA you maintain all levels in transaction BP, and CVI writes them to the classic tables.
| Level | Scope | Typical content | Classic table | Key |
|---|---|---|---|---|
| General | Client-wide | Name, address, tax numbers, bank details | LFA1 (plus LFBK for banks) | LIFNR |
| Company code | One company code | Reconciliation account, payment terms, payment methods, dunning | LFB1 | LIFNR, BUKRS |
| Purchasing organization | One purchasing organization | Order currency, purchasing payment terms, Incoterms, invoice verification flags | LFM1 | LIFNR, EKORG |
Some data on these levels is not stored in the supplier tables first. Name, address and identification are business partner data (BUT000, ADRC, BUT0ID). CVI copies the relevant fields to LFA1 so that purchasing and accounting transactions keep working unchanged.
Roles decide which levels you can maintain
A supplier is a business partner that has a supplier role. The role controls which tab groups appear in transaction BP.
- FLVN00 is the supplier role for financial accounting. It opens the company code data.
- FLVN01 is the supplier role for purchasing. It opens the purchasing organization data.
- A partner with only the general role (000000) has no supplier record at all.
Adding FLVN00 or FLVN01 to a partner that has none triggers CVI to create the LFA1 record and assign a supplier number. The number comes from the number range tied to the partner's grouping. When the partner number and supplier number ranges are synchronized, both numbers are identical.
How the tables connect
CVI stores the link in table CVIVENDLINK. It maps the business partner's technical key (PARTNER_GUID) to the supplier number (VENDOR). Company code and purchasing data hang off the supplier number, not off the partner number.
This reading follows the diagram:
- One partner has at most one supplier link.
- One supplier has one general record.
- One supplier has zero or more company code records and zero or more purchasing organization records.
Working through the levels in transaction BP
Open a partner in change mode and select the role Supplier (FLVN00) or Supplier (FLVN01) in the role dropdown. Then work from broad to narrow.
- General data. On the address, identification and control tabs you maintain the data valid for every organizational unit. Examples are the legal name, tax numbers, and the supplier's search term. The payment transactions tab holds bank details. Bank details are shared by all company codes.
- Company code data. Choose the Company Code button and select or add a company code. The tabs here hold the reconciliation account, payment terms, payment methods, house bank selection and the posting block. Each company code has its own values, so one supplier can be paid on different terms in different legal entities.
- Purchasing organization data. Choose the Purchasing Organization button and select or add an organization. Here you set the order currency, purchasing payment terms, Incoterms, and the goods-receipt-based invoice verification flag. Partner functions (for example, ordering address or invoicing party) are also stored at this level.
The two lower levels are independent. A supplier can be extended to a company code without any purchasing organization, as in the case of a one-time payee. The reverse is allowed technically, but invoices cannot be posted without company code data.
Reading the three levels with a table join
The following ABAP reads each supplier's number together with its company code data. It runs in any system where you have read access to the tables.
SELECT b~partner,
l~lifnr,
l~name1,
f~bukrs,
f~akont,
f~zterm
FROM but000 AS b
INNER JOIN cvi_vend_link AS v
ON v~partner_guid = b~partner_guid
INNER JOIN lfa1 AS l
ON l~lifnr = v~vendor
INNER JOIN lfb1 AS f
ON f~lifnr = l~lifnr
WHERE b~type = '2'
INTO TABLE @DATA(lt_supplier_cc)
UP TO 20 ROWS.The inner join to LFB1 drops suppliers with no company code extension. To include them, change that join to LEFT OUTER JOIN. For purchasing data, join LFM1 on lifnr in the same way and read ekorg.
Reading the three levels through the API
The released OData service APIBUSINESSPARTNER exposes the supplier levels as entity sets. The sets are ASupplier, ASupplierCompany and A_SupplierPurchasingOrg. The next request reads one supplier and expands the lower levels.
GET /sap/opu/odata/sap/API_BUSINESS_PARTNER/A_Supplier('0000100001')?$select=Supplier,SupplierName&$expand=to_SupplierCompany,to_SupplierPurchasingOrg
Accept: application/jsonEach supplier in the response has two child lists. to_SupplierCompany holds company code fields such as CompanyCode, ReconciliationAccount and PaymentTerms. to_SupplierPurchasingOrg holds PurchasingOrganization, PurchaseOrderCurrency and PaymentTerms. The supplier number 0000100001 is only an example. Use one from your system.
Common errors
| Symptom | Likely cause | What to check |
|---|---|---|
| Company code tab is missing | Partner has only FLVN01 | Add role FLVN00 |
| Purchasing organization tab is missing | Partner has only FLVN00 | Add role FLVN01 |
| Save fails with a CVI error about the reconciliation account | Required field empty on company code level | Fill the field, or check the account group customizing |
| Supplier number differs from partner number | Number ranges not synchronized, or external numbering used | Review the grouping and its supplier number range |
| Supplier exists in LFA1 but has no LFB1 row | Company code extension never created | Open the company code view in transaction BP and save |
| Payment terms differ between company code and purchasing | Two separate fields on two levels | Maintain both, or accept the difference by design |
Design points to remember
- Put data on the narrowest level that is true. A bank account valid everywhere belongs to the general level. A payment term that differs per legal entity belongs to the company code level.
- Number of company code and purchasing records grows with organizational units, not with partners. A global supplier used in 40 company codes has 40 LFB1 rows.
- Blocks exist at several levels. A central posting block on the general level stops all posting. A block at company code or purchasing organization level stops only that scope.
Exercise
A partner has role FLVN01 only. A colleague wants to post an invoice to this supplier in company code 1000. Which role and which level are missing, and where in the tables will the new record appear?
Show answer
The partner needs role FLVN00, which opens the company code level. After you add the role and save the company code data for 1000, CVI creates a row in LFB1 keyed by the existing supplier number (LIFNR) and company code 1000 (BUKRS). The general record in LFA1 and the CVIVENDLINK entry already exist and do not change.
Exercise
Write the OData request path that returns only the company code data of supplier 0000100001, without the general or purchasing data.
Show answer
Use the navigation property from the supplier: GET /sap/opu/odata/sap/APIBUSINESSPARTNER/ASupplier('0000100001')/toSupplierCompany. Alternatively, filter the entity set directly: A_SupplierCompany?$filter=Supplier eq '0000100001'.