SAP MDG · VALIDATION DERIVATION
How do I implement SAP MDG BAdI USMD_RULE_SERVICE method CHECK_EDITION_START?
Implement the BAdI in SE19 for definition USMD_RULE_SERVICE, assign an implementing class that contains IF_EX_USMD_RULE_SERVICE~CHECK_EDITION_START, then add your edition-based validation logic there; if the method is only a framework hook in your release, you can leave it empty and keep the real business checks in CHECK_ENTITY or the relevant edition method.
Implement the BAdI in SE19 for definition USMD_RULE_SERVICE, assign an implementing class that contains IF_EX_USMD_RULE_SERVICE~CHECK_EDITION_START, then add your edition-based validation logic there; if the method is only a framework hook in your release, you can leave it empty and keep the real business checks in CHECK_ENTITY or the relevant edition method.
Use transaction SE18 to inspect BAdI definition USMD_RULE_SERVICE, then create the implementation in SE19, assign the implementing class, and place your edition-specific logic in IF_EX_USMD_RULE_SERVICE~CHECK_EDITION_START. The method is part of the standard USMD rule-service lifecycle, so you should only validate here when the rule must run at the start of an edition; otherwise keep the stub and implement the actual business rule in the appropriate validation method.
Process flow
- Use SE18 to display BAdI definition
USMD_RULE_SERVICEand confirm interface IF_EX_USMD_RULE_SERVICE. - Use SE19 to create the implementation with a Z* name, package, and transport request.
- If the BAdI is filter-dependent, maintain the required filter values.
- Create or assign the implementing class and activate it.
- Implement IF_EX_USMD_RULE_SERVICE~CHECK_EDITION_START for start-of-edition validation logic.
- Activate the class, then activate the BAdI implementation.
- Trigger the MDG edition scenario and debug the method to verify that it is called.
ILLUSTRATIVE ABAP SAMPLE
Source ABAP implementation example
Concrete CHECK_ENTITY implementation pattern from the same knowledge document set.
1METHOD if_ex_usmd_rule_service~check_entity.
2 DATA: lo_app_context TYPE REF TO if_usmd_app_context,
3 lt_message TYPE usmd_t_message,
4 ls_message TYPE usmd_s_message,
5 lv_crtype TYPE usmd_crequest_type,
6 lv_crstep TYPE usmd_crequest_appstep,
7 lv_crid TYPE usmd_crequest.
8
9 FIELD-SYMBOLS: <ls_data> TYPE any,
10 <lv_value> TYPE any.
11
12 lo_app_context = cl_usmd_app_context=>get_context( ).
13 CHECK lo_app_context IS BOUND.
14 CHECK io_model->d_usmd_model = 'BP'.
15
16 lo_app_context->get_attributes(
17 IMPORTING
18 ev_crequest_type = lv_crtype
19 ev_crequest_step = lv_crstep
20 ev_crequest_id = lv_crid ).
21
22 CHECK it_data IS NOT INITIAL.
23
24 LOOP AT it_data ASSIGNING <ls_data>.
25 ASSIGN COMPONENT 'SOME_MAND_FIELD' OF STRUCTURE <ls_data> TO <lv_value>.
26 IF <lv_value> IS ASSIGNED AND <lv_value> IS INITIAL.
27 CLEAR ls_message.
28 ls_message-msgid = 'ZMDG_SUPPL'.
29 ls_message-msgno = '001'.
30 ls_message-msgty = 'E'.
31 ls_message-fieldname = 'SOME_MAND_FIELD'.
32 APPEND ls_message TO et_message.
33 ENDIF.
34 ENDLOOP.
35
36 IF et_message IS NOT INITIAL.
37 zcl_mdgbp_bp_validation=>adjust_messages(
38 EXPORTING
39 cr_number = lv_crid
40 CHANGING
41 ct_message = et_message ).
42 ENDIF.
43ENDMETHOD.The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How do I add validation logic in IF_EX_USMD_RULE_SERVICE~CHECK_EDITION_START?
- What is the standard setup for a CHECK_EDITION_START implementation in SAP MDG?
- How do I activate and test a
USMD_RULE_SERVICEedition-start check?
Possible questions
- How do I implement SAP MDG BAdI
USMD_RULE_SERVICEmethod CHECK_EDITION_START? - How do I add validation logic in IF_EX_USMD_RULE_SERVICE~CHECK_EDITION_START?
- What is the standard setup for a CHECK_EDITION_START implementation in SAP MDG?
- How do I activate and test a
USMD_RULE_SERVICEedition-start check? - Which TCode is used to create a BAdI implementation from SE18?
- What should go into CHECK_EDITION_START versus CHECK_ENTITY?