Post presents a high-level mapping of SAP ERP to SAP Commerce (formerly know as hybris). I will start with an introduction to SAP S/4HANA / ERP nomenclature and SAP Commerce entities. Then the mapping will be presented with sample impexes.

SAP ERP intro

Master data is at the heart of sales and distribution processes in every ERP. Materials (products) and business partners (customers) form the basis for sales processing. Here I will focus on the Customer Master which in case of SAP backend (SAP S/4HANA, SAP ERP) revolves around 3 main entities:

  • Customer
  • Contact person
  • Partner functions

ERP :: Customer

Simply put – this is a company registered in ERP. In the case of SAP Commerce integration, we are mostly interested in Sales and Distribution (S&D) processes and data which consist of a couple of parts:

  • General data of the customer (KNA1 table in ERP) which includes fields like Customer Number, Name, etc)
  • Partner Functions
  • Sales-Area specific data (KNVV table) – customer information which is relevant for S&D processes and is specific to a given Sales Area (a combination of Sales organization, Distribution channel and Division). Data like Partner Functions are applicable only for that specific Sales Area.

ERP :: Sales Organization

Sales Organization in SAP Sales & Distribution module is the highest level in the organizational hierarchy. Its primary role is to carry out sales and monitor them. Id of the sales organization is used extensively in any integration documentation and is referred to as VKORG. This is usually a 4 character literal (e.g. 2300).

ERP :: Distribution Channel

It represents the channel through which we want to reach the customers. Represented in SAP using 2 characters (e.g. A1) stored in VTWEG field.

ERP :: Division

The division may represent a product line of the business or logical grouping of materials/services that share some specifics/features (e.g. division of Sales and Spare Parts). Stored in SAP using 2 characters (e.g. 77) in SPART field.

ERP :: Sales Area

As already mentioned this is a combination of Sales organization, Distribution channel and Division and is a key concept that will be extensively referred to throughout the article. Sales Area may be visualized as:

ERP :: Partner Functions

Another crucial piece of information in Customer Master is a named relation between particular SAP Customers aka Partner Functions. They represent parties involved in the sales processing (e.g. party to which the goods will be shipped, party responsible for payments, etc.) and are stored in KNVP table.

Sample partner function data may look like:

KUNNRKUNN2PARVW
0000180400002590WE (ship-to)

Above configuration can be read as:

Party (customer) identified using id 00001804 has a shipping party identified using id 00002590.

Most common partner functions are:

code (PARVW)meaningdescription
AGsold-tocustomer who is buying
WEship-toparty to which the goods will be shipped
REbill-toparty which will be stated on the invoice
RGpayerparty which will pay for the goods

SAP Commerce

Commerce :: B2BUnit

Main entity used in modeling of Customer Organization. Represents SAP Customer with sold-to partner function.

B2BUnits can be nested thus creating a hierarchy of items in which different levels represent organizational structure from ERP.

Additionally, B2BUnit can be grouped using OrgUnit to create logical groupings for further maintenance and management.

Commerce :: B2BCustomer

This is simply a user who logs in to the SAP Commerce and is associated with a particular company – B2BUnit. Specific roles and permissions are granted to such user through UserGroup assignment (e.g. b2badmingroup, b2bcustomergroup, etc.).

B2BCustomer represents a Contact Person in ERP. You should not confuse B2BCustomer (who is a real user of the commerce) with SAP Customer which a company on behalf of which the user acts. Usually, the case is that the contact person does not exist in ERP and is registered first directly in SAP Commerce and then optionally replicated back to the ERP.

Commerce:: Address

Address represents Partner Function and contains the address data of the target party + the information about the type of partner function (stored as a set of flags on the Address).

Address has one owner – is associated with one item. The implication of this fact is that multiple duplicates of single SAP address data may exist in the system!

Finally: the mapping!

SAP Customer is replicated to a 2-level hierarchy of B2BUnits.

The first level of B2BUnit represents the SAP Customer – without the context of specific SalesArea. It contains general company data like: SAP identifier (KUNNR, stored in B2BUnit.uid property), name, contact address.

The second level of B2BUnit contains data in context of a specific Sales Area. Most importantly it contains the list of Addresses that reflect the partner functions. These child B2BUnits have a special suffix added to SAP identifier of the company – this suffix is the Sales Area code.

Sales Area code is created by concatenation of Sales Organization (VKORG), Distribution Channel (VTWEG) and Division (SPART), separating the components with _ sign:

{KUNNR}_{VKORG}_{VTWEG}_{SPART}
{SAP Customer ID}_{Sales Org}_{Distrib Channel}_{Division}

e.g.:

0000001804_2300_A1_77

Partner functions (like ship-tos, bill-tos) are then mapped to such child B2BUnits as Addresses. Ship-tos information is reflected on the Address by setting shippingAddress boolean property. Similarly, for bill-tos there is billingAddress flag.

Example from the diagram is shown below in the form of an Impex file:

 #SAP Customer
INSERT_UPDATE B2BUnit; uid[unique = true]; name; groups(uid); &B2BUnitID;
; 0000001804            ; Company 0000001804 (general data)           ;            ; 0000001804

; 0000001804_2300_A1_77 ; Company 0000001804 (SalesArea specific: B0) ; 0000001804 ; 0000001804_2300_A1_77
; 0000001804_2300_B0_77 ; Company 0000001804 (SalesArea specific: A1) ; 0000001804 ; 0000001804_2300_B0_77

#Partner Functions
INSERT_UPDATE Address; publickey[unique = true]; streetname[unique = true]; town; country(isocode); billingAddress; shippingAddress; owner(&B2BUnitID);
; 0000001804_2300_A1_77|0000002590|KNA1|WE ; 120 Baker Drive ; Chicago ; US ; FALSE ; TRUE  ; 0000001804_2300_A1_77 ;
; 0000001804_2300_A1_77|0000002671|KNA1|RE ; 8 Mile Road     ; Detroit ; US ; TRUE  ; FALSE ; 0000001804_2300_A1_77 ;

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *