SAP MDG · REPLICATION INBOUND

How does an SAP MDG inbound proxy for customer creation validate input and create the customer record?

The inbound customer creation method first validates request, customer number, and country through `zcl_mdgc_online_store_util->validate`, then loads sales/company constants, checks destination mapping in `zmdg_os_repmap`, and finally calls `zcl_mdgc_online_store_util->create_v2` to create the customer. If validation or destination mapping fails, it returns the error message immediately.

The inbound customer creation method first validates request, customer number, and country through `zcl_mdgc_online_store_util->validate`, then loads sales/company constants, checks destination mapping in `zmdg_os_repmap`, and finally calls `zcl_mdgc_online_store_util->create_v2` to create the customer. If validation or destination mapping fails, it returns the error message immediately.

The inbound customer creation proxy follows a simple gate-and-create pattern: it first reads the request payload, populates the output header, validates `req_id`, customer number, and country, then enriches the request with company/sales constants before calling the create routine. If validation fails or destination mapping is missing, it returns the error immediately.

Process flow

  1. Read `input-mt_dct_customer_create_request` into `ls_customer` and initialize `ls_output`.
  2. Set response control fields and copy the requested customer number.
  3. Call `zcl_mdgc_online_store_util->validate` with request ID, customer number, and country.
  4. Proceed only if validation returns type `S`.
  5. Map inbound fields to local variables for company, address, tax, and sales data.
  6. Derive company-code and sales-area defaults from `ls_tvta` and `ls_constants`, using fallback values if needed.
  7. Read `zmdg_os_repmap` for the target destination using `sap_destination_ecc`.
  8. Return a fatal response if the destination is not configured in `zmdg_os_repmap`.","Call `zcl_mdgc_online_store_util->create_v2` with the assembled customer data and destination.","Copy the returned customer number, message, and type back,`

Customer-specific configuration via replication mapping table `zmdg_os_repmap`

Maintains the RFC destination used by the inbound proxy when `sap_destination_ecc` is mapped to the backend destination.

Referenced tables

ObjectPurpose
zmdg_os_repmapMapping table used to find the backend destination for the target ECC system.
zmdg_os_tvtaProvides organizational defaults such as company code, sales organization, distribution channel, sales office, sales group, and incoterms.
zmdg_os_s_constantsHolds optional constant overrides used to default account, payment terms, payment history, sorting, and related customer values.

ILLUSTRATIVE ABAP SAMPLE

Source ABAP example

Exact relevant implementation excerpt from the knowledge document.

1METHOD zii_si_dct_customer_create_inb~si_dct_customer_create_inbound. 2 3 DATA: 4 lo_online_util TYPE REF TO zcl_mdgc_online_store_util, 5 ls_tvta TYPE zmdg_os_tvta, 6 ls_constants TYPE zmdg_os_s_constants, 7 lv_cust_number TYPE kunnr, 8 lv_country TYPE land1_gp, 9 lv_req_id TYPE zmdg_os_reqid, 10 lv_comp_name TYPE name1_gp, 11 lv_cust_name TYPE name2_gp, 12 lv_stras TYPE stras_gp, 13 lv_stras2 TYPE stras_gp, 14 lv_city TYPE ort01_gp, 15 lv_state TYPE regio, 16 lv_pstlz TYPE ad_pstcd1, 17 lv_telf1 TYPE telf1, 18 lv_telf2 TYPE telf2, 19 lv_fax TYPE teltx, 20 lv_email TYPE ad_smtpadr, 21 lv_currency TYPE waers_v02d, 22 lv_guest TYPE zmdg_de_guestacct, 23 lv_taxid TYPE stceg, 24 lv_bukrs TYPE bukrs, 25 lv_akont TYPE akont, 26 lv_zterm_knb1 TYPE dzterm, 27 lv_xzver TYPE xzver, 28 lv_zuawa TYPE dzuawa, 29 lv_vkorg TYPE vkorg, 30 lv_vtweg TYPE vtweg, 31 lv_vkbur TYPE vkbur, 32 lv_vkgrp TYPE vkgrp, 33 lv_inco1 TYPE inco1, 34 lv_inco2 TYPE inco2, 35 lv_zterm_knvv TYPE dzterm, 36 lv_rfc_subrc LIKE sy-subrc, 37 lv_start_time TYPE i, 38 lv_end_time TYPE i. 39 40 GET RUN TIME FIELD lv_start_time. 41 CREATE OBJECT lo_online_util. 42 43 IF lo_online_util IS BOUND. 44 DATA(ls_customer) = input-mt_dct_customer_create_request. 45 DATA(ls_output) = output-mt_dct_customer_create_respons. 46 47 ls_output-controller = input-controller. 48 ls_output-cust_number = ls_customer-i_cust_number. 49 CONCATENATE sy-sysid '-' sy-mandt INTO ls_output-http_location_code. 50 ls_output-return-controller = input-controller. 51 52 lv_req_id = ls_customer-i_req_id. 53 lv_country = ls_customer-i_country. 54 lv_cust_number = ls_customer-i_cust_number. 55 56 lo_online_util->validate( 57 EXPORTING 58 iv_req_id = lv_req_id 59 iv_cust_number = lv_cust_number 60 iv_country = lv_country 61 IMPORTING 62 ev_return = DATA(lv_validation_ret) 63 es_tvta = ls_tvta 64 es_constants = ls_constants 65 ). 66 67 IF lv_validation_ret-type = 'S'. 68 69 lv_comp_name = ls_customer-i_comp_name. 70 lv_cust_name = ls_customer-i_cust_name. 71 lv_stras = ls_customer-i_stras. 72 lv_stras2 = ls_customer-i_stras2. 73 lv_city = ls_customer-i_city. 74 lv_state = ls_customer-i_state. 75 lv_pstlz = ls_customer-i_pstlz. 76 lv_telf1 = ls_customer-i_telf1. 77 lv_telf2 = ls_customer-i_telf2. 78 lv_fax = ls_customer-i_fax. 79 lv_email = ls_customer-i_email. 80 lv_currency = ls_customer-i_currency. 81 lv_guest = ls_customer-i_guest. 82 lv_taxid = ls_customer-i_taxid. 83 84 lv_bukrs = ls_tvta-bukrs. 85 86 IF ls_constants-akont IS NOT INITIAL. 87 lv_akont = ls_constants-akont. 88 ELSE. 89 lv_akont = '0001040100'. 90 ENDIF. 91 92 IF ls_constants-zterm_knb1 IS NOT INITIAL. 93 lv_zterm_knb1 = ls_constants-zterm_knb1. 94 ELSE. 95 lv_zterm_knb1 = 'A069'. 96 ENDIF. 97 98 IF ls_constants-xzver IS NOT INITIAL. 99 lv_xzver = ls_constants-xzver. 100 ELSE. 101 lv_xzver = 'X'. 102 ENDIF. 103 104 IF ls_constants-zuawa IS NOT INITIAL. 105 lv_zuawa = ls_constants-zuawa. 106 ELSE. 107 lv_zuawa = '009'. 108 ENDIF. 109 110 lv_vkorg = ls_tvta-vkorg. 111 112 IF ls_constants-vtweg IS NOT INITIAL. 113 lv_vtweg = ls_constants-vtweg. 114 ELSE. 115 lv_vtweg = ls_tvta-vtweg. 116 ENDIF. 117 118 IF ls_constants-vkbur IS NOT INITIAL. 119 lv_vkbur = ls_constants-vkbur. 120 ELSE.

The remaining configuration, implementation details, and testing guidance continue from this answer more…

Related questions and keywords

Alternative questions

  • How do I implement the inbound customer creation proxy logic in SAP MDG?
  • What is the pattern for an MDG inbound customer creation service method?
  • How does the customer creation inbound proxy validate data and call the create routine?

Possible questions

  • How do I implement the inbound customer creation proxy logic in SAP MDG?
  • What is the pattern for an MDG inbound customer creation service method?
  • How does the customer creation inbound proxy validate data and call the create routine?
  • Which method validates and creates the customer in the DCT inbound proxy?
  • How is destination mapping checked before customer creation?

Keywords

SAP MDGABAPinbound proxycustomer creationvalidationdestination mappingservice interfaceZCL_SI_DCT_CUSTOMER_CREATE_INBZII_SI_DCT_CUSTOMER_CREATE_INB~SI_DCT_CUSTOMER_CREATE_INBOUNDzcl_mdgc_online_store_utilzmdg_os_repmap