SAP MDG · UTILITIES
How do I implement BP tax-code mapping to the correct customer or vendor tax fields during CVI conversion in SAP MDG?
Implement a custom `IF_EX_CVI_CUSTOM_MAPPER` class that reads BP tax numbers, uses `ZMDG_BP_MAP_VAT` to determine the target field by country and tax category, writes the value into the customer or vendor structure, and sets the related X-structure field.
Implement a custom `IF_EX_CVI_CUSTOM_MAPPER` class that reads BP tax numbers, uses `ZMDG_BP_MAP_VAT` to determine the target field by country and tax category, writes the value into the customer or vendor structure, and sets the related X-structure field.
Implement `ZCL_MDGBP_CVI_CUSTOM_MAPPER` as the CVI mapper for BP tax numbers. The class reads the BP address country from the first address, selects customizing rows from `ZMDG_BP_MAP_VAT`, matches BP tax types against the configured tax-category pattern, and writes the mapped value into the target customer or vendor field while updating the X-structure.
Process flow
- Implement `ZCL_MDGBP_CVI_CUSTOM_MAPPER` for `IF_EX_CVI_CUSTOM_MAPPER`.
- Maintain BP-to-field mapping records in `ZMDG_BP_MAP_VAT`.
- Use `ZZBP_CAT = 'CUST'` for customer and `ZZBP_CAT = 'SUPL'` for vendor mapping.
- Read BP tax numbers from the partner central data tax-number table.
- Use the first BP address to derive the country-specific mapping filter.
- Match `DATA_KEY-TAXTYPE` against the customizing tax-category pattern.
- Write the mapped value into the field name stored in `ZZFIELD_NAME`.
- Set the corresponding X-structure field to `abap_true`.','Skip entries where `TASK = 'D'`.','Optionally derive `ZZWWIBC` from `BRSCH` using `ZCL_MDG_CUS_APPROVERS=>GET_IBC_FROM_TED`.','Leave the contact and reverse-mapping hooks as no-op if
Referenced tables
| Object | Purpose |
|---|---|
ZMDG_BP_MAP_VAT | Custom mapping table that drives object category, country restriction, tax-category pattern, and target field name (`ZZFIELD_NAME`). |
USMD1210 | Change request note table used in related MDG utility logic when notes must be written to a change request. |
BUT000 | Business Partner active data table referenced in related MDG/CVI processing context. |
CVI_VEND_LINK | Vendor-to-BP link table used in related CVI utility logic. |
ILLUSTRATIVE ABAP SAMPLE
Source ABAP example: ZCL_MDGBP_CVI_CUSTOM_MAPPER_FULL.abap
Exact relevant implementation excerpt from the knowledge document set.
1class ZCL_MDGBP_CVI_CUSTOM_MAPPER definition
2 public
3 final
4 create public .
5
6public section.
7
8 interfaces IF_BADI_INTERFACE .
9 interfaces IF_EX_CVI_CUSTOM_MAPPER .
10protected section.
11private section.
12ENDCLASS.
13
14
15
16CLASS ZCL_MDGBP_CVI_CUSTOM_MAPPER IMPLEMENTATION.
17
18
19 method IF_EX_CVI_CUSTOM_MAPPER~MAP_BP_REL_TO_CUSTOMER_CONTACT.
20 RETURN.
21 endmethod.
22
23
24 method IF_EX_CVI_CUSTOM_MAPPER~MAP_BP_REL_TO_VENDOR_CONTACT.
25 RETURN.
26 endmethod.
27
28
29 METHOD if_ex_cvi_custom_mapper~map_bp_to_customer.
30***********************************************************************************************
31*Implementation: This method is implemented to Mapp the BP Tax Codes to Customer Tax fields SCT*
32* Based on the Tax code mapping Table ZMDG_BP_MAP_VAT.
33* Created by: TE579309
34* Created on: 29.08.2028
35***********************************************************************************************
36 DATA: lt_bp_tax TYPE bus_ei_bupa_taxnumber_t,
37 ls_bp_tax TYPE bus_ei_bupa_taxnumber,
38 lv_country TYPE land1,
39 lv_pattern TYPE char5,
40 lt_address TYPE bus_ei_bupa_address_t.
41 lt_address[] = i_partner-central_data-address-addresses[].
42 READ TABLE lt_address INTO DATA(ls_address) INDEX 1.
43 CONCATENATE '%' ls_address-data-postal-data-country '%' INTO lv_pattern.
44 SELECT * FROM zmdg_bp_map_vat INTO TABLE @DATA(lt_bp_map_vat) WHERE zzbp_cat = 'CUST' AND zztax_cat LIKE @lv_pattern.
45 IF sy-subrc IS INITIAL.
46 lt_bp_tax = i_partner-central_data-taxnumber-taxnumbers.
47 IF lt_bp_tax[] IS NOT INITIAL.
48 LOOP AT lt_bp_map_vat INTO DATA(ls_bp_map_vat).
49 READ TABLE lt_bp_tax INTO ls_bp_tax WITH KEY data_key-taxtype = ls_bp_map_vat-zztax_cat.
50 IF sy-subrc IS INITIAL AND ls_bp_tax-task NE 'D'.
51 IF ls_bp_tax-data_key-taxnumber IS NOT INITIAL.
52 c_customer-central_data-central-data-(ls_bp_map_vat-zzfield_name) = ls_bp_tax-data_key-taxnumber.
53 ELSE.
54 c_customer-central_data-central-data-(ls_bp_map_vat-zzfield_name) = ls_bp_tax-data_key-taxnumxl.
55 ENDIF.
56 c_customer-central_data-central-datax-(ls_bp_map_vat-zzfield_name) = abap_true.
57 ELSE.
58 c_customer-central_data-central-data-(ls_bp_map_vat-zzfield_name) = ''.
59 ENDIF.
60 c_customer-central_data-central-datax-(ls_bp_map_vat-zzfield_name) = abap_true.
61 ENDLOOP.
62 ENDIF.
63 ENDIF.
64
65 IF c_customer-central_data-central-data-brsch IS NOT INITIAL.
66 CALL METHOD zcl_mdg_cus_approvers=>get_ibc_from_ted
67 EXPORTING
68 iv_industry_code = c_customer-central_data-central-data-brsch
69 IMPORTING
70 ev_indbuscode = DATA(lv_zzwwibc).
71
72 IF lv_zzwwibc IS NOT INITIAL.
73 c_customer-central_data-central-data-zzwwibc = lv_zzwwibc.
74 c_customer-central_data-central-datax-zzwwibc = abap_true.
75 ENDIF.
76 ENDIF.
77
78* SELECT * FROM zmdg_bp_map_vat INTO TABLE @DATA(lt_bp_map_vat) WHERE zzbp_cat = 'CUST'.
79*** IF sy-subrc IS INITIAL.
80*** lt_bp_tax = i_partner-central_data-taxnumber-taxnumbers.
81*** IF lt_bp_tax[] IS NOT INITIAL.
82*** LOOP AT lt_bp_tax INTO ls_bp_tax.
83*** LOOP AT lt_bp_map_vat INTO DATA(ls_bp_map_vat).
84*** IF ls_bp_tax-data_key-taxtype CP ls_bp_map_vat-zztax_cat.
85*** IF ls_bp_tax-data_key-taxnumber IS NOT INITIAL.
86*** c_customer-central_data-central-data-(ls_bp_map_vat-zzfield_name) = ls_bp_tax-data_key-taxnumber.
87*** ELSE.
88*** c_customer-central_data-central-data-(ls_bp_map_vat-zzfield_name) = ls_bp_tax-data_key-taxnumxl.
89*** ENDIF.
90*** c_customer-central_data-central-datax-(ls_bp_map_vat-zzfield_name) = abap_true.
91*** EXIT.
92*** ENDIF.
93*** c_customer-central_data-central-datax-(ls_bp_map_vat-zzfield_name) = abap_true.
94*** ENDLOOP.
95*** ENDLOOP.
96*** ELSE.
97*** LOOP AT lt_bp_map_vat INTO ls_bp_map_vat.
98*** c_customer-central_data-central-data-(ls_bp_map_vat-zzfield_name) = ''.
99*** c_customer-central_data-central-datax-(ls_bp_map_vat-zzfield_name) = abap_true.
100*** ENDLOOP.
101*** ENDIF.
102*** ENDIF.
103 ENDMETHOD.
104
105
106 method IF_EX_CVI_CUSTOM_MAPPER~MAP_BP_TO_CUSTOMER_CONTACT.
107 RETURN.
108 endmethod.
109
110
111 METHOD if_ex_cvi_custom_mapper~map_bp_to_vendor.
112***********************************************************************************************
113*Implementation: This method is implemented to Mapp the BP Tax Codes to Vendor Tax fields SCT*
114* Based on the Tax code mapping Table ZMDG_BP_MAP_VAT.
115* Created by: TE579309
116* Created on: 29.08.2028
117***********************************************************************************************
118 DATA: lt_bp_tax TYPE bus_ei_bupa_taxnumber_t,
119 ls_bp_tax TYPE bus_ei_bupa_taxnumber,
120 lv_country TYPE land1,The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How does IF_EX_CVI_CUSTOM_MAPPER map BP tax numbers to customer/vendor fields?
- How can I configure tax-field mapping for BP-to-Customer and BP-to-Vendor CVI?
- How do I use ZMDG_BP_MAP_VAT in a custom CVI mapper?
Possible questions
- How do I implement BP tax-code mapping to the correct customer or vendor fields during CVI conversion in SAP MDG?
- What is the purpose of ZCL_MDGBP_CVI_CUSTOM_MAPPER?
- How do I map BP tax numbers into customer and vendor tax fields using IF_EX_CVI_CUSTOM_MAPPER?
- How do I handle deleted BP tax numbers during CVI mapping?
- How do I derive additional fields such as ZZWWIBC during BP-to-customer mapping?