SAP MDG · UTILITIES

How do I implement BP tax-number mapping to the correct customer or vendor tax fields during CVI conversion in SAP MDG?

`ZCL_MDGBP_CVI_CUSTOM_MAPPER` implements `IF_EX_CVI_CUSTOM_MAPPER` to map BP tax numbers into the correct customer or vendor tax fields during CVI conversion, using country- and tax-type-driven customizing from `ZMDG_BP_MAP_VAT` and updating the matching X-structure fields.

`ZCL_MDGBP_CVI_CUSTOM_MAPPER` implements `IF_EX_CVI_CUSTOM_MAPPER` to map BP tax numbers into the correct customer or vendor tax fields during CVI conversion, using country- and tax-type-driven customizing from `ZMDG_BP_MAP_VAT` and updating the matching X-structure fields.

`ZCL_MDGBP_CVI_CUSTOM_MAPPER` is the CVI custom mapper for BP tax numbers. It uses the BP address country as the first filter, reads mapping rows from `ZMDG_BP_MAP_VAT`, splits logic by `ZZBP_CAT = 'CUST'` or `ZZBP_CAT = 'SUPL'`, and writes the matched BP tax value into the mapped customer or vendor field while also updating the X-structure.

Process flow

  1. 1. Implement or enhance the CVI exit class `ZCL_MDGBP_CVI_CUSTOM_MAPPER` for `IF_EX_CVI_CUSTOM_MAPPER`.
  2. 2. Read BP tax numbers from `I_PARTNER-CENTRAL_DATA-TAXNUMBER-TAXNUMBERS`.
  3. 3. Derive the country filter from the first BP address.
  4. 4. Read mapping rows from `ZMDG_BP_MAP_VAT` for the correct object category (`CUST` or `SUPL`).
  5. 5. Compare `DATA_KEY-TAXTYPE` with the customizing tax-category pattern.
  6. 6. Write the tax number into the field named in `ZZFIELD_NAME` using dynamic field access.
  7. 7. Set the corresponding X-structure field to `abap_true`.
  8. 8. Skip entries where `TASK = 'D'`.,

Referenced tables

ObjectPurpose
ZMDG_BP_MAP_VATCustomizing table that maps BP tax categories, country-specific rules, and target field names for customer/vendor tax-field assignment.

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 ZCL_MDGBP_CVI_CUSTOM_MAPPER map BP tax numbers to customer/vendor fields?
  • How do I configure and code BP-to-Customer/Supplier tax mapping in CVI?
  • How are BP tax numbers written into customer or vendor fields during CVI?

Possible questions

  • What is the purpose of ZCL_MDGBP_CVI_CUSTOM_MAPPER?
  • Which customizing table controls BP tax-field mapping?
  • How does the mapper decide between customer and vendor targets?
  • Does the mapper skip deleted BP tax numbers?
  • How is the X-structure updated during tax mapping?
  • What does the class do with industry code BRSCH?

Keywords

CVIBusiness PartnerCustomer Vendor Integrationtax numbersZCL_MDGBP_CVI_CUSTOM_MAPPERIF_EX_CVI_CUSTOM_MAPPERZMDG_BP_MAP_VATMAP_BP_TO_CUSTOMERMAP_BP_TO_VENDORdynamic component accessX-structureTASK = 'D'BRSCHZCL_MDG_CUS_APPROVERS=>GET_IBC_FROM_TED