Example: Adding Customer ABC Classification
Introduction
Business Partners in ERP have a field called "Customer classification (ABC analysis)" on their Sales Data. This field does not exist in CRM hence is not replicated between the two systems.
The task was to create the field in CRM and have it replicated with ERP - in both ways. To achieve this, the CRM Middleware had to be enhanced.
From ERP to CRM
In the following chapter you'll find the developments done in the ERP and CRM system in order to send the ABC classification of a customer from ERP to CRM.
General information
ABC class. in ERP:
Table | KNVV |
Field | KLABC |
Key fields of table | KUNNR, VKORG, VTWEG, SPART |
Enhancement Steps in ERP
Customizing of User Exit
The CRM Middleware can be enhanced using User Exits which are triggered by certain Interface Processes. These processes are found in table TPS01 whereas the ones starting with 'CRM' concern the middleware.
First however a so called Customer Product is needed which later on will be assigned to the user exit. The customer product is customized via sm30 of table TBE24. It consists of a product name, description, optionally of a RFC destination (if the called user exit is not in the same system) and an activation flag.
Product | ZBPPRIE |
Text | BUPA Pricing Extension |
RFC-destination |
|
Active | X |
Now a User Exit can be customized via sm30 of table TPS34. The process "user-exit before data is sent" is the one to use (CRM0_200). A new function module needs to be created and the newly added customer product needs to be assigned (through its activation flag is the user-exit called or not).
Process | CRM0_200 |
Country |
|
Appl. |
|
Function | Z_CRM_MW_BP_PRICING_OUT |
Product | ZBPPRIE |
Function for User Exit
Table TPS01 contains sample function modules for all processes with the corresponding parameter interface. It is best to copy the sample function of the process chosen; in this case SAMPLE_PROCESS_CRM0_200.
The TABLES-parameter T_BAPISTRUCT contains all data (tables, structures and fields) which will be sent to CRM. The standard structures cannot have append structures therefore enhancements must be appended to that table as if they were a table themselves (at least is this the only way I could find).
Function Z_CRM_MW_BP_PRICING_OUT
Enhancement Steps in CRM
Finding the right place for the "new" field
The ABC classification field does not exist in CRM and must be created first. It should be together with the other customer sales - pricing (billing) data. On the WebUI would that be following: Account Details -> Sales Area Data -> Billing
Technically are the pricing data in the Business Partner Set 0030:
What |
Type |
Name |
Description |
---|---|---|---|
Link between Business Partner and Set 0030 | Table | CRMM_BUT_LNK0031 | Business Partner - Billing Rule |
Data of Set 0030 | Table | CRMM_BUT_SET0030 | Business Partner: Billing Data |
Data Structure of Set 0030 | Structure | CRMT_BUS_SET0030 | CRM BP Set Structure for Billing Data |
Data X-Structure of Set 0030 | Structure | CRMT_BUS_SET0030X | CRM BP Update Structure for Billing Data |
The right place for the ABC classification field is therefore an append structure of structure CRMT_BUS_SET0030.
Create "new" field
I created an append structure called ZMW_PRICING_EXT_S with only field ZZKLABC of type KLABC and added it to CRMT_BUS_SET0030.
I created an other append structure called ZMW_PRICINGX_EXT_S with only field ZZKLABC of type BU_UPDFLAG and added it to CRMT_BUS_SET0030X.
Customizing of User Exit
The CRM Middleware is also enhanced via User Exits on the CRM site. These exits are also triggered by processes which can be found in table TPS01. Unlike in ERP did I find that the processes starting with 'CRM' are not the ones to use but instead those starting with 'SMOUTIL'.
But first a Customer Product is needed - just like in ERP. It is also customized via sm30 of table TBE24.
Product | ZBPPRIE |
Text | BUPA Pricing Extension |
RFC-destination |
|
Active | X |
The actual User Exit is customized via sm30 of table TPS34. The process "user-exit for upload" is the one to use (SMOUTIL3). A new function module needs to be created and the newly added customer product needs to be assigned (through its activation flag is the user-exit called or not).
Process | SMOUTIL3 |
Country |
|
Appl. |
|
Function | Z_CRM_MW_BP_PRICING_IN |
Product | ZBPPRIE |
Function for User Exit
Again it is best to copy the sample function from table TPS01 for the chosen process; in this case SAMPLE_PROCESS_SMOUTIL3.
The TABLES-parameter TI_BAPIMTCS corresponds to T_BAPISTRUCT from ERP and contains all data (tables, structures and fields) that is sent from ERP.
Function Z_CRM_MW_BP_PRICING_IN
Adjusting CRM
In the following chapters is the new ABC classification added to the WebUI in CRM. It should be possible to see, change and search for it.
Displaying ABC Classification
Where on the WebUI the field is added i already mentioned. This corresponds to component BP_SALES and View CorpAccountBillingEF.
Because we appended the new field to the official pricing structure is it automatically available when changing the configuration of the named view. So all that is left to do is choose it and put it at wished position onto the view (for the corresponding Role Key).
SAP Standard Change; making a pricing field editable
The above step displays the ABC classification and it is also possible to change the value. But that change is never kept! That is because the pricing fields are handled hardcoded in SAP Standard (which is also why enhancing the view with AET does not work) and thus a new field has to be coded as well.
SAP Standard Objects
Following standard objects are affected by the needed change:
Object |
Name |
Description |
---|---|---|
Function group | CRM_BUPA_CRMC_DIALOG | Dialog Processing of BP Billing Data |
Include | LCRM_BUPA_CRMC_DIALOGF06 | Implementation of Local Class lcl_fragment_instance_memory |
Local Class | lcl_fragment_instance_memory |
|
Method | set_set_on | Set Set data with a update fla |
Making ABC Classification searchable
Add field to Business Partner Header Search
For being able to choose the ABC classification as a search parameter it has to exist in the BP Header Search Structure CRMT_BUPA_IL_HEADER_SEARCH; I created append structure ZCRM_BP_HEAD_SEARCH_PRICING with field ZZKLABC of type KLABC.
Now it can be added to the configuration of component BP_HEAD_SEARCH view MainSearch.
Programming to search after new field
The BP Header Search logic can be enhanced by implementing BAdI BADI_CRM_BUPA_IL_SEARCH_EXT. This creates following objects:
Object |
Name |
Description |
---|---|---|
BAdI Implementation | ZBP_SEARCH_PRICING_EXT | Business Partner Search Ext. for Pricing |
Implementing Class | ZCL_BP_SEARCH_PRICING_EXT | Class for BAdI Impl.: ZBP_SEARCH_PRICING_EXT |
Method | SEARCH_CRITERIA_INITIAL | Checks if parameters of this implementation are filled |
Method | SEARCH_PARTNERS | Extracts/filters according to the search parameter |
The search logic simply checks the ABC classification with the two Set 0030 tables CRMM_BUT_LNK0031 and CRMM_BUT_SET0030.
From CRM to ERP
In the following chapter you'll find the developments done in the ERP and CRM system in order to send the ABC classification of a customer from CRM to ERP.
Enhancement Steps in CRM
Customizing of User Exit
A new User Exit is needed in order to send additional data from CRM to ERP. The same Customer Product as maintained before in table TBE24 can be used. However a new function module for the "user-exit before sending data" process (SMOUTIL2) must be created.
Process | SMOUTIL2 |
Country |
|
Appl. |
|
Function | Z_CRM_MW_BP_PRICING_OUT |
Product | ZBPPRIE |
Function for User Exit
Copy the sample function from table TPS01 for the chosen process; in this case SAMPLE_PROCESS_SMOUTIL2.
Again we're using the TABLES-parameter T_BAPIMTCS to append "our own table" with the ABC-classification (and corresponding customer and sales area) as data.
Function Z_CRM_MW_BP_PRICING_OUT
SAP Standard Change; triggering replication to ERP for a new pricing field
The triggering of the replication with ERP (meaning noticing a change that should be sent) is again hardcoded for the pricing fields thus needs a change in SAP Standard.
SAP Standard Objects
Following standard objects are affected by the needed change:
Object |
Name |
Description |
---|---|---|
Function group | CRM_BUPA_MWX_BDOC_OUTBOUND | Outbound Processing |
Function module | CRM_BUPA_BDOC_BPS_FILL_DATA | Fill BP Set Structure from Table |
Include | LCRM_BUPA_MWX_BDOC_OUTBOUNDF10 |
|
Form routine | get_salesarea_segment | Collect sales areas and corresponding Sets |
Each time the fields of Set 0030 were hardcoded, I had to add the ABC-classification field (which is five times in total). Only with this change will CRM send the changed ABC-classification to ERP if only that one field was changed -> only then the created user exit is called.
Enhancement Steps in ERP
Customizing of User Exit
A new User Exit is needed in order to handle additional data sent from CRM to ERP. The same Customer Product as maintained before in table TBE24 can be used. However a new function module for the "user-exit for upload" process (CRM0_300) must be created.
Process | CRM0_300 |
Country |
|
Appl. |
|
Function | Z_CRM_MW_BP_PRICING_IN |
Product | ZBPPRIE |
Function for User Exit
Copy the sample function from table TPS01 for the chosen process; in this case SAMPLE_PROCESS_CRM0_300.
Again we're using the TABLES-parameter T_BAPIMTCS to read "our own table" containing the ABC-classification (and corresponding customer and sales area).
Function Z_CRM_MW_BP_PRICING_IN