
This blog is about restrict legal entity proposals at transaction CVI_LEDH by implementing a BAdI. CVI_LEDH is used to determine potential customer and vendor to merge them into a single Business Partner. With this transaction you can define, which data (address, bank data, tax number) should be the leading one for Business Partner creation process in terms of CVI (Customer Vendor Integration).
A detail decription of CVI_LEDH usage you can find at blog post
SAP S/4HANA Business Partner Conversion – Merge Customer and Vendor using Transaction CVI_LEDH (Lega...
Guidance at legal entity merge you will find at blog post
SAP S/4HANA Business Partner Conversion - Merge Customer and Vendor into single Business Partner
Target audience: Functional expert, Development expert
Version: SAP ECC 6.0 or higher
If you run transaction CVI_LEDH the system determines potential pairs of customers and vendors which are linked via KNA1-LIFNR and LFA1-KUNNR and could be used for legal entity merge scenario.
Very often not all potential pairs shall be really merged into a single Business Partner. In this case it is very difficult to find relevant pairs if the list of potential candidates is very long and and filled with unwanted merge candidates.
This blog describes a way to reduce list of potential candidates. At this example only these pairs should be merged where customer and vendor account group are stored at custom customizing table.
In this example only data with customer account group 0001 and vendor account group 0001 should be merged.
In addition to reduce customer vendor pairs in CVI_LEDH transaction you have to exclude not relevant (not in CVI_LEDH maintained) pairs from legal entity merge scenario in BAdI CVI_CUSTOM_MAPPER.
As you can see at below screenshot there are 4 potential legal entity merge candidates determined by transaction CVI_LEDH.
Following Account Groups are used for example customers and vendors.
Customers 13483 to 13485 are created with Account Group DEBI.
Vendors 100354 to 100356 are created with Account Group KRED.
Customer A0004 is created with Account Group 0001.
Vendor A0001 is created with Account Group 0001.
Remark: it is not mandatory that customer and vendor has the same Account Group key.
At CVI mapping configuration following mapping has been set
For Customer
Cross-Application Components->Master Data Synchronization->Customer/Vendor Integration->Business Partner Settings->Settings for Customer Integration->Field Assignment for Customer Integration->Assign Keys->Define Number Assignment for Direction Customer to BP
For Vendor
Cross-Application Components->Master Data Synchronization->Customer/Vendor Integration->Business Partner Settings->Settings for Vendor Integration->Field Assignment for Vendor Integration->Assign Keys->Define Number Assignment for Direction Vendor to BP
The target is to restrict entries in transaction CVI_LEDH to relevant account groups. Unfortunately this could not done with standard tool like BAdI implementation. If you would do like to do so, you are forced to implement a temporary modification (see bottom of this blog).
Main part is custom control table and control merge entities by BAdI CVI_CUSTOM_MAPPER implementation. Secondary and optional is reducing of entries in transaction CVI_LEDH.
I recommend to use a custom table to store relevant customer/vendor account groups. The advantage is, that you can reuse this table to include these relevant account groups for legal entity merge in BAdI CVI_CUSTOM_MAPPER.
I just entered a very simple example with only one customer and one vendor account group. At this table you can define your own more complex criteria. In this table customer account group is marked with "C" and vendor account group is marked with "V".
To avoid legal entity merge for mentioned account groups above, you have to skip legal entity merge program logic. Therefore a BAdI implementation for CVI_CUSTOM_MAPPER is needed and standard delivery implementation has to deactivated.
Create your own implementation and copy coding from
standard implementation CVI_MAP_LEGAL_ENTITY
method IF_EX_CVI_CUSTOM_MAPPER~MAP_CUSTOMER_TO_BP and
method IF_EX_CVI_CUSTOM_MAPPER~MAP_VENDOR_TO_BP
into your corresponding methods.
Unfortunately method STORE_MSG is not created automatically. Create this method at your implementating class definition.
Find here example coding for additional lines to standard coding of method IF_EX_CVI_CUSTOM_MAPPER~MAP_CUSTOMER_TO_BP
Add lines right after declaration area.
* restrict legal entity merge
data: ls_merge TYPE zbp_merge.
clear ls_merge.
SELECT SINGLE * from zbp_merge INTO ls_merge
where accgrp = I_CUSTOMER-CENTRAL_DATA-CENTRAL-DATA-KTOKD
and cv = 'C'.
check ls_merge IS NOT INITIAL.
* restrict legal entity merge
Find here example coding for additional lines to standard coding of method IF_EX_CVI_CUSTOM_MAPPER~MAP_VENDOR_TO_BP
Add lines right after declaration area.
* restrict legal entity merge
data: ls_merge TYPE zbp_merge.
clear ls_merge.
SELECT SINGLE * from zbp_merge INTO ls_merge
where accgrp = I_VENDOR-CENTRAL_DATA-CENTRAL-DATA-KTOKK
and cv = 'V'.
check ls_merge IS NOT INITIAL.
* restrict legal entity merge
Navigate into IMG: Cross-Application Components -> Master Data Synchronization -> Customer/Vendor Integration -> Business Partner Settings -> Business Add-Ins (BAdIs) -> BAdI: Data Assignment BP <-> Customer/Vendor/Contact Person
Your for exclusion defined account groups will now ignored at legal entity merge scenarion and created as separated Business Partners as you know it.
Optional:
This solution controls only merging based on account groups BUT this will not having any impact on transaction CVI_LEDH which list can be very huge. A solution might be to implement a modification only for CVI conversion purpose. You can modify class CL_CVI_LE_DATA_HARMONIZATION method PREPARE_DATA_ALV_OUTPUT. At the end you will find ALV output structure GT_ALV_OUTPUT which you can restrict based on you custom table logic. After conversion you should undo modification.
Unfortunately BAdI CVI_LE_DATA_HARMONIZATION will not help. With this BAdI you have only the option to add customer/vendor pairs based on your custom logic.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
31 | |
7 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
2 | |
2 |