- 24 Sep 2024
- 8 Minutes to read
- Print
- DarkLight
Synchronize account data
- Updated on 24 Sep 2024
- 8 Minutes to read
- Print
- DarkLight
Zilliant CPQ supports account data synchronization from ERP, including:
- Basic account data, such as customer ID and VATID
- Corresponding addresses
- Sales area information
To control the number of accounts available for synchronization from ERP to CPQ, you must create a database view in the ERP system. Using this view, you can filter on account ERP data. This reduces the number of customer accounts synced to CPQ.
CPQ uses a URI to uniquely identify each customer/account object. The URI includes the hostname of the ERP system, which is the source system. It also includes the customer/object ID to make it unique for each customer/object.
The host name is found from the destination ECC_RFC_DESTINATION and follows the pattern of host name and client.
Following is an example of an account URI:
http://imc.prod/800/Account#0000123456
Parts of the URI are defined as follows:
• prod—ERP hostname. This comes from jco.client.ashost or jco.client.mshost.
• 800—Client. This comes from client.client.
• Account—Name of the type of object in CPQ.
• 123456—Customer ID.
In CPQ, Account and Customer are used interchangeably.
Select and filter data in ERP
CPQ uses database views in ERP to determine which objects should be synced to CPQ. This also applies to account synchronization. Zilliant recommends maintaining all of the views discussed in the following sections at one time.
Create database views by using transaction SE11.
Because the ERP system does not support the concept of DISTINCT when creating views, database filters may return duplicated records. CPQ handles this by eliminating duplicates.
Sync an account
For synchronization to work, first create a database view named Z_ISS_CUSTOMER. If the account sales area needs to be synced from the view, use the following columns:
* MANDT
* KUNNR
* VKORG
* VTWEG
* SPART
If the account sales area information is not needed from the view, use the following columns:
* MANDT
* KUNNR
The view in the following images is based on standard ERP tables KNA1 and KNVV. Using this view, you can also pre-filter the accounts/customers in ERP that are to be synced to CPQ.
Depending on the filter conditions, the view may need to perform a join on different tables and a selected set of conditions. Filters should be applied depending on each customer's business case.
Zilliant recommends that you carefully determine the selections that should be available to the customer in CPQ as this impacts the performance of data synchronization. The larger the data set, the more time takes to complete the sync, resulting in increased database usage in CPQ.
Enable the SettingERPAccountSyncWithSalesAreaFromView setting to synchronize sales area information from the ERP database view. If it is not enabled, CPQ will use BAPI to read this information more in product data sync.
The following sections describe what happens when the SettingERPAccountSyncWithSalesAreaFromView setting is on or off.
Selected Sales Area Information Setting: On
If SettingERPAccountSyncWithSalesAreaFromView is on, CPQ attempts to synchronize the sales area information from ERP. The following fields must be set to mandatory in the database view:
* KUNNR
* VKORG
* VTWEG
* SPART
Any additional fields are ignored.
All Sales Area Information Setting: Off
If the implementation requires only account information, or if the SettingERPAccountSyncWithSalesAreaFromView setting is off, the only mandatory field in the database view is KUNNR.
However, CPQ still synchronizes the sales area for the customer. You have the option to maintain the sales area in the database view; otherwise, CPQ syncs all customer sales areas using alternate BAPI BAPI_CUSTOMER_GETSALESAREAS.
The following images provide examples:
Synchronize a customer
To explicitly synchronize a customer:
- Sign in to CPQ.
- In the left navigation area, select System Processes.
- From the top navigation bar, select ERP Synchronization.
- Select the Sync icon at the top right.
- In the Sync Specific pop-up, select Account and provide the full customer/account in the ERP ID field.
Run a background sync
Follow these steps to run sync in the background:
- Sign in to CPQ.
- In the left navigation area, select System Processes.
- From the top navigation bar, select ERP Synchronization.
- Select the Sync icon at the top right.
- Set Accounts switch to NO.
- Set the Run in background switch to NO.
You can also set up a system task to run the account sync in the background:
- In the CPQ left navigation area, select Administration.
- Select System Task.
- Create a task with a cron expression string. Use the task resource AccountSyncJob.
There is delta sync in ERP account/customer synchronization because there is no correct way to know the last changed date on an account. In this case, setting up an account sync job may consume some system resources depending on the number of ERP customers to sync.
Prerequisites
Basic data prerequisites for account sync are:
- Currency
- Language
- Country
- Country Region
- Sales Org
- Distribution Channel
- Division
- Sales Office
- Inco Terms
- Payment Terms
- Partner Function
These data points with ERP IDs must be maintained in advance of account sync.
Sync partner function
In addition to account sync, CPQ enables you to synchronize partner functions defined for an account from ERP.
CPQ reads directly from the ERP table KNVP to get all the partner functions for the account. However, CPQ creates partner functions for the sales info/area (sales org, distribution channel, and division) that are maintained in the system.
Only two sales areas are maintained in CPQ, as shown in the following image:
The following image shows the contents of the KNVP table for account 1000 in the ERP system. Because only two sales areas are maintained in the system, partner functions that are maintained in these two sales areas are synced to CPQ, as highlighted in the following image:
Only some partner functions are maintained in CPQ, providing customization functionality for only certain partner functions that can be synchronized into CPQ.
For example, the following image shows the partner function master data maintained in the system. In this case, notice that “RE” is not maintained as a partner function ERP ID.
Manage partner function
During quote creation and quote copy, CPQ provides standard functionality to copy account partner functions of the same sales area as the quote partner functions. Achieve this by enabling *SettingAddAccountKeyPartnersToQuote.
If more than one partner function record is found for the same sales area, logic is applied to choose a key partner. The partner function set as default is the highest priority, followed by the increasing order of position. If no default is found, the partner function with the least position number is picked up as a partner.
If you do not want to use the standard implementation, define your own logic by choosing a default partner in the post-quote creation process.
If you want to use the standard implementation with a custom implementation, follow this sequence:
- Standard implementation—Add all partner functions from Account to Quote of the same sales area.
- Post Quote creation script—Additional defaulting. In this case, it important to check for duplicate partner records.
The partner function sync is supported only for partner function type Account and User. It is not supported for other function types, such as Contact.
Account sync switch from BAPI to API
The JCo library that we use,
* BAPI_CUSTOMER_GETDETAIL2
* BAPI_CUSTOMER_GETSALESAREAS
* ISA_CUSTOMER_SALES_READ
returns an output structure as follows:
- One or more structures, such as CUSTOMERADDRESS. The system may or may not use a particular structure.
- Each structure consists of one or more values, such as NAME or NAME_2.
The following table shows examples.
IMC Object Type | IMC Field | BAPI | Structure | Value | Remarks |
---|---|---|---|---|---|
Account | objectName | BAPI_CUSTOMER_GETDETAIL2 | CUSTOMERADDRESS | NAME + “ “ + NAME_2 + “ “ + NAME_3 + “ “ + NAME_4 | The result is trimmed to remove trailing whitespace. |
Account | objectERPId | BAPI_CUSTOMER_GETDETAIL2 | CUSTOMERADDRESS | CUSTOMER | |
Account | vatId | BAPI_CUSTOMER_GETDETAIL2 | CUSTOMERGENERALDETAIL | VAT_REG_NO | |
Account | hasAccountStatus | http://www.inmindcloud.com/application/schema.owl#ACTIVE | Hardcoded value | ||
Account | accountGroup | BAPI_CUSTOMER_GETDETAIL2 | CUSTOMERGENERALDETAIL | ACCNT_GRP | |
Account | hasLanguage | BAPI_CUSTOMER_GETDETAIL2 | CUSTOMERADDRESS | LANGU_ISO | Value must be mapped to an existing Language’s ERP ID. Otherwise, it is blank. |
Account | hasCurrency | BAPI_CUSTOMER_GETDETAIL2 | CUSTOMERGENERALDETAIL | CURRENCY_ISO | Value must be mapped to an existing Currency’s ERP ID. Otherwise, it is blank. |
Address | addressStreet | BAPI_CUSTOMER_GETDETAIL2 | CUSTOMERADDRESS | STREET | |
Address | addressZip | BAPI_CUSTOMER_GETDETAIL2 | CUSTOMERADDRESS | POSTL_CODE | |
Address | addressCity | BAPI_CUSTOMER_GETDETAIL2 | CUSTOMERADDRESS | CITY | |
Address | addressPhone | BAPI_CUSTOMER_GETDETAIL2 | CUSTOMERADDRESS | TELEPHONE | |
Address | hasCountryRegion | BAPI_CUSTOMER_GETDETAIL2 | CUSTOMERADDRESS | REGION | Value must be mapped to an existing CountryRegion’s ERP ID. Otherwise, it is blank. |
Address | hasCountry | BAPI_CUSTOMER_GETDETAIL2 | CUSTOMERADDRESS | COUNTRYISO | Value must be mapped to an existing Country’s ERP ID. Otherwise, it is blank. |
Address | addressMain | true | Hardcoded value | ||
SalesInfo | hasSalesOrg | BAPI_CUSTOMER_GETSALESAREAS | SALESAREAS | SALESORG | Value must be mapped to an existing SalesOrg’s ERP ID. Otherwise, the sales info is not imported. |
SalesInfo | hasDistributionChannel | BAPI_CUSTOMER_GETSALESAREAS | SALESAREAS | DISTRCHN | Value must be mapped to an existing DistributionChannel’s ERP ID. Otherwise, the sales info is not imported. |
SalesInfo | hasDivision | BAPI_CUSTOMER_GETSALESAREAS | SALESAREAS | DIVISION | Value must be mapped to an existing Division’s ERP ID. Otherwise, the sales info is not imported. |
SalesInfo | hasPaymentTerms | ISA_CUSTOMER_SALES_READ | CUST_SALES_DATA | ZTERM | Value must be mapped to an existing PaymentTerms’ ERP ID. Otherwise, it is blank. |
SalesInfo | hasIncoTerms | ISA_CUSTOMER_SALES_READ | CUST_SALES_DATA | INCO1 | Value must be mapped to an existing IncoTerms’ ERP ID. Otherwise, it is blank. |
SalesInfo | quoteIncoTermsLocation | ISA_CUSTOMER_SALES_READ | CUST_SALES_DATA | INCO2 | |
SalesInfo | accountPricingProcedureIndicator | ISA_CUSTOMER_SALES_READ | CUST_SALES_DATA | KALKS | |
SalesInfo | hasShippingCondition | ISA_CUSTOMER_SALES_READ | CUST_SALES_DATA | VSBED | Value must be mapped to an existing ShippingCondition’s ERP ID. Otherwise, it is blank. |
SalesInfo | hasPriceList | ISA_CUSTOMER_SALES_READ | CUST_SALES_DATA | PLTYP | Value must be mapped to an existing PriceList’s ERP ID. Otherwise, it is blank. |
SalesInfo | hasPriceGroup | ISA_CUSTOMER_SALES_READ | CUST_SALES_DATA | KONDA | Value must be mapped to an existing PriceGroup’s ERP ID. Otherwise, it is blank. |
SalesInfo | hasSalesOffice | ISA_CUSTOMER_SALES_READ | CUST_SALES_DATA | VKBUR | Value must be mapped to an existing SalesOffice’s ERP ID. Otherwise, it is blank. |
SalesInfo | hasSalesGroup | ISA_CUSTOMER_SALES_READ | CUST_SALES_DATA | VKGRP | Value must be mapped to an existing SalesGroup’s ERP ID. Otherwise, it is blank. |
SalesInfo | hasCurrency | ISA_CUSTOMER_SALES_READ | CUST_SALES_DATA | WAERS | The first 3 characters of Value must be mapped to an existing Currency’s ERP ID. Otherwise, it is blank. |
For Partner Function, it is not read from a BAPI. It is instead read directly from the KNVP table, filtered by KUNNR = accountERPID and clientColumn of MANDT. The resulting fields from the table are mapped as shown in the following table.
IMC Object Type | IMC Field | Column | Remarks |
---|---|---|---|
PartnerFunctionRecord | linksPartner | KUNN2 or PERNR | Depending on the partner function, this can be mapped to the ERP ID of an Account (KUNN2) or an Employee (PERNR). |
PartnerFunctionRecord | hasPartnerFunction | PARVW | Value must be mapped to an existing PartnerFunction’s ERP ID. Otherwise, the partner function record is not imported. |
PartnerFunctionRecord | salesInfoPartnerFunctionRecordDefinedBy | VKORG, VTWEG, SPART | These values must be mapped to an existing SalesInfo of the Account. VKORG is the SalesOrg, VTWEG is the DistributionChannel, and SPART is the Division. |
PartnerFunctionRecord | partnerFunctionRecordDefault | DEFPA | True if value = “X” |
PartnerFunctionRecord | sequenceID | PARZA |