SAP MDG · REPLICATION INBOUND
How do I implement customer BPM validation in an SAP MDG inbound proxy class?
Implement the customer validation in MDG_VALIDATE_BPM_CUSTOMER after the proxy entry method has filtered the payload. The sample pattern validates partner existence, customer role, account group, industry mapping, and BPM-specific approval/block status, then separates records into validated and discarded lists with BAPIRET2 error messages.
Implement the customer validation in MDG_VALIDATE_BPM_CUSTOMER after the proxy entry method has filtered the payload. The sample pattern validates partner existence, customer role, account group, industry mapping, and BPM-specific approval/block status, then separates records into validated and discarded lists with BAPIRET2 error messages.
Implement the customer BPM validation in the `MDG_VALIDATE_BPM_CUSTOMER` method of `ZCL_SI_MDG_CUSTOMER_INBOUND`. The runtime flow is: proxy entry method receives the inbound records, validation converts the partner with `CONVERSION_EXIT_ALPHA_INPUT`, checks customer existence and roles via `BUT000` and `BUT100`, verifies `KNA1` account group and industry, and finally appends valid records to `et_validated_customer` while collecting rejected records in `et_discarded_customer` with detailed `BAPIRET2` messages.
Process flow
- Start in `ZCL_SI_MDG_CUSTOMER_INBOUND->ZII_SI_MDG_CUSTOMER_INBOUND~SI_MDG_CUSTOMER_INBOUND` and pass only usable customer records to validation.
- Normalize `PARTNER_TE_CUSTOMER_ACCT_NBR` with `CONVERSION_EXIT_ALPHA_INPUT`.
- Read `BUT000` and `BUT100` to confirm the partner exists and has customer roles `FLCU00` or `FLCU01`.
- Read `KNA1-KTOKD` and require the BPM-valid account group `0001`.
- Read `KNA1-BRSCH` and validate the industry mapping in `ZMDG_BP_BRSCH` where `ZBRAN_BPM = 'X'`.
- Validate BPM-specific fields `BPM_APP_LEVEL_CODE` and `PARTNER_BLOCK_STATUS_CODE`.
- Append accepted records to `ET_VALIDATED_CUSTOMER`.
- Build `BAPIRET2` messages and `CVIS_MESSAGE` output for rejected records and append them to `ET_DISCARDED_CUSTOMER`.
Referenced tables
| Object | Purpose |
|---|---|
BUT000 | Business partner existence and general partner data check. |
BUT100 | Business partner role check for `FLCU00` and `FLCU01`. |
KNA1 | Customer account group `KTOKD` and industry code `BRSCH` validation. |
ZMDG_BP_BRSCH | Custom BPM industry mapping check using `ZBRAN_BPM = 'X'`. |
ILLUSTRATIVE ABAP SAMPLE
Source ABAP example
Exact relevant implementation excerpt from the knowledge document.
1METHOD mdg_validate_bpm_customer.
2 TYPES: BEGIN OF ty_but000,
3 partner TYPE but000-partner,
4 bu_group TYPE but000-bu_group,
5 type TYPE but000-type,
6 partner_guid TYPE but000-partner_guid,
7 END OF ty_but000,
8
9 BEGIN OF ty_but100,
10 partner TYPE but100-partner,
11 rltyp TYPE bu_partnerrole,
12 END OF ty_but100.
13
14
15 DATA:
16 ls_customer TYPE zdt_mdg_customer_record,
17 ls_customer_formated TYPE zmdg_bpm_customer_record,
18 ls_crequest TYPE usmd_s_crequest,
19 ls_message TYPE bapiret2,
20 ls_usmd_value TYPE usmd_s_value,
21 lt_but000 TYPE TABLE OF ty_but000,
22 lt_but100 TYPE TABLE OF ty_but100,
23 lt_usmd_value TYPE usmd_ts_value,
24 lt_message TYPE bapiret2_t,
25 lt_out_message TYPE cvis_message,
26 lt_crequest TYPE usmd_ts_crequest,
27 lv_app_level TYPE zmdg_de_deapprlvl,
28 lv_app_status TYPE zmdg_de_bpmappstat,
29 lv_brsch TYPE kna1-brsch,
30 lv_ktokd TYPE kna1-ktokd,
31 lv_partner TYPE bu_partner,
32 lv_sec_id TYPE zsecurim.
33
34 LOOP AT it_current_customer INTO ls_customer.
35 CLEAR: lt_usmd_value, lt_crequest, ls_crequest.
36
37 lv_partner = ls_customer-partner_te_customer_acct_nbr.
38
39 CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
40 EXPORTING
41 input = lv_partner
42 IMPORTING
43 output = lv_partner.
44
45 ls_customer_formated-partner_te_customer_acct_nbr = lv_partner.
46 ls_customer_formated-partner_profile_id = ls_customer-partner_profile_id.
47 ls_customer_formated-bpm_app_level_code = ls_customer-bpm_app_level_code.
48 ls_customer_formated-partner_block_status_code = ls_customer-partner_block_status_code.
49 ls_customer_formated-aufsd = ls_customer-aufsd.
50 ls_customer_formated-lifsd = ls_customer-lifsd.
51
52
53
54 SELECT partner bu_group type partner_guid INTO TABLE lt_but000
55 FROM but000
56 WHERE partner = lv_partner. "#EC CI_SUBRC
57
58 SELECT partner rltyp INTO TABLE lt_but100
59 FROM but100
60 WHERE partner = lv_partner. "#EC CI_SUBRC
61
62 IF lines( lt_but000 ) >= 1.
63 LOOP AT lt_but100 INTO DATA(ls_but100) WHERE rltyp = 'FLCU00' OR rltyp = 'FLCU01'.
64 DATA(lv_cus_exits) = abap_true.
65 ENDLOOP.
66
67
68 IF lv_cus_exits = abap_true.
69 SELECT SINGLE ktokd FROM kna1 INTO lv_ktokd
70 WHERE kunnr = lv_partner.
71
72 IF sy-subrc = 0.
73
74 IF lv_ktokd IS NOT INITIAL.
75
76 IF lv_ktokd = '0001'.
77
78 SELECT SINGLE brsch FROM kna1 INTO lv_brsch
79 WHERE kunnr = lv_partner.
80
81 IF sy-subrc = 0 AND lv_brsch IS NOT INITIAL.
82 SELECT SINGLE brsch FROM zmdg_bp_brsch INTO @DATA(lv_industry)
83 WHERE brsch = @lv_brsch
84 AND zbran_bpm = 'X'.
85
86 IF sy-subrc = 0."IS BPM
87
88 IF ls_customer_formated-bpm_app_level_code NE '0'.
89 CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
90 EXPORTING
91 input = ls_customer_formated-bpm_app_level_code
92 IMPORTING
93 output = ls_customer_formated-bpm_app_level_code.
94
95 IF ls_customer_formated-partner_block_status_code NE '0'.
96 CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
97 EXPORTING
98 input = ls_customer_formated-partner_block_status_code
99 IMPORTING
100 output = ls_customer_formated-partner_block_status_code.
101
102 APPEND ls_customer_formated TO et_validated_customer.
103 ELSE.
104 "& Business Partner &1, invalid Approval Level for BPM &2
105 ls_message-id = 'ZMDG_BP_BPM_INTF'.
106 ls_message-number = 019.
107 ls_message-type = 'E'.
108 ls_message-message_v1 = lv_partner.
109 ls_message-message_v2 = ls_customer_formated-partner_block_status_code.
110 APPEND ls_message TO lt_message.
111 CLEAR ls_message.
112 lt_out_message-is_error = abap_true.
113 lt_out_message-messages = lt_message.
114 ls_customer_formated-error_messages = lt_out_message.
115 APPEND ls_customer_formated TO et_discarded_customer.
116 CLEAR: lt_out_message, lt_message.
117 ENDIF.
118 ELSE.
119 "& Business Partner &1, invalid BPM Application status &2
120 ls_message-id = 'ZMDG_BP_BPM_INTF'.The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- What logic should go into MDG_VALIDATE_BPM_CUSTOMER?
- How does the customer inbound proxy validate BPM customer records?
- How do I filter valid and discarded customer inbound records in SAP MDG?
Possible questions
- What logic should go into MDG_VALIDATE_BPM_CUSTOMER?
- How does the customer inbound proxy validate BPM customer records?
- How do I filter valid and discarded customer inbound records in SAP MDG?
- Can I reuse the same validation pattern for vendor inbound?
- What messages are raised when BPM customer validation fails?