SAP MDG · UTILITIES

How do I implement BP-to-Customer and BP-to-Vendor tax mapping in the CVI custom mapper BAdI?

Implement IF_EX_CVI_CUSTOM_MAPPER so BP tax numbers are mapped to customer or vendor tax fields using country- and category-specific rows from ZMDG_BP_MAP_VAT, then set the corresponding X-structure flags. The customer path also derives ZZWWIBC from BRSCH when available.

Implement IF_EX_CVI_CUSTOM_MAPPER so BP tax numbers are mapped to customer or vendor tax fields using country- and category-specific rows from ZMDG_BP_MAP_VAT, then set the corresponding X-structure flags. The customer path also derives ZZWWIBC from BRSCH when available.

Use IF_EX_CVI_CUSTOM_MAPPER in class ZCL_MDGBP_CVI_CUSTOM_MAPPER to translate BP tax numbers into customer or vendor tax fields during CVI conversion. The implementation reads the first BP address to derive the country filter, selects mapping rows from ZMDG_BP_MAP_VAT by object category (CUST or SUPL), matches BP tax types against ZZTAX_CAT, and fills the target field named in ZZFIELD_NAME while also updating the X-structure.

Process flow

  1. Implement or activate class ZCL_MDGBP_CVI_CUSTOM_MAPPER for IF_EX_CVI_CUSTOM_MAPPER.
  2. Read BP address data and derive the country from the first address entry.
  3. Select ZMDG_BP_MAP_VAT rows for ZZBP_CAT = 'CUST' or 'SUPL' and the country-specific tax category pattern.
  4. Read I_PARTNER-CENTRAL_DATA-TAXNUMBER-TAXNUMBERS and match DATA_KEY-TAXTYPE to ZZTAX_CAT.
  5. Write TAXNUMBER or TAXNUMXL into the field named in ZZFIELD_NAME using dynamic component access.
  6. Set the corresponding X-structure field to abap_true.
  7. For customer mapping, derive ZZWWIBC from BRSCH using ZCL_MDG_CUS_APPROVERS=>GET_IBC_FROM_TED.
  8. Leave the contact/relation and reverse-mapping methods as no-op RETURN methods unless business rules require otherwise.

Referenced tables

ObjectPurpose
ZMDG_BP_MAP_VATCustomizing table that maps BP tax categories to target customer/vendor field names via ZZBP_CAT, ZZTAX_CAT, and ZZFIELD_NAME.

ILLUSTRATIVE ABAP SAMPLE

Source ABAP example

Exact relevant implementation excerpt from the knowledge document.

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 can I fill customer and vendor tax fields from BP tax numbers during CVI conversion?
  • How do I use ZMDG_BP_MAP_VAT in IF_EX_CVI_CUSTOM_MAPPER?

Possible questions

  • What class implements IF_EX_CVI_CUSTOM_MAPPER for this mapping?
  • Which table controls the BP tax field mapping?
  • How are deleted BP tax entries handled?
  • How is the country determined before mapping tax numbers?
  • How is ZZWWIBC derived in the customer mapping?

Keywords

ZCL_MDGBP_CVI_CUSTOM_MAPPERIF_EX_CVI_CUSTOM_MAPPERCVI_CUSTOM_MAPPERZMDG_BP_MAP_VATBP tax number mappingcustomer tax fieldsvendor tax fieldsX-structureTAXNUMBERTAXNUMXLTASK = 'D'ZZFIELD_NAMEZZBP_CATBRSCHZZWWIBC