Documente Academic
Documente Profesional
Documente Cultură
Applicable Releases:
MDG7.0 and Later
Version 1.0
Jan 2017
How To... MDG-S: Dynamic Workflow Processing based on changes to bank details
2
www.sap.com
Document History
TABLE OF CONTENTS
1. BUSINESS SCENARIO ........................................................................................................................................... 5
2. PREREQUISITES ................................................................................................................................................... 5
3. INTRODUCTION................................................................................................................................................... 5
3.1. STORY BOOK ................................................................................................................................................... 5
3.2. HIGH LEVEL STEPS ........................................................................................................................................... 5
4. STEP-BY-STEP EXPLANATION ............................................................................................................................... 6
4.1. CREATE NEW CHANGE REQUEST TYPE .......................................................................................................................... 6
4.2. IMPLEMENTATION OF BADI ....................................................................................................................................... 7
4.3. CREATE ABAP DICTIONARY OBJECTS .......................................................................................................................... 10
4.4. MODELING BRF+ ELEMENTS AND THE PROCESS FLOW IN BRF+ ...................................................................................... 11
4.5. IMPLEMENT ABAP CLASS ........................................................................................................................................ 17
4.6. TEST .................................................................................................................................................................... 20
5. REMARKS ...........................................................................................................................................................22
4
How To... MDG-S: Dynamic Workflow Processing based on changes to bank details
1. BUSINESS SCENARIO
SAP Master Data Governance for Supplier (MDG-S) provides business processes to find, create, change,
and mark supplier master data for deletion. It supports the governance of supplier master data on a central
hub and the distribution of supplier master data to connected operational and business intelligence systems.
The processes are workflow-driven and can include several approval and revision phases, including
collaboration between all users participating in master data maintenance. The workflows which are delivered
in MDG-S standard are classic workflows and do support most of the existing business use cases such as:
- Approval of global relevant attributes
- Parallel processing based on organizational units
- Final approval by organizational unit.
Sometimes the business requirements are different, and the classic workflow templates shipped by SAP do
not fit to the customer needs. Because of that, customers can also use the Rule-Based Workflow template
(RBW) which gives full flexibility for the workflow modeling. This is done by maintaining BRF+ decision
tables. SAP MDG delivers this RBW Template as standard and it can be used in MDG-S (and MDG-C). It is
integrated into the SAP MDG customizing (Shortcut: mdgimg).
Based on this template it is possible to have dynamic workflow routing based on values entered during
runtime by the user.
This How-To guide shows how to use these capabilities and how to implement such requirements. The
example scenario we are using is the following: An existing supplier can be changed using SAP MDG-S
without any approval. Only if the bank details have been changed an approver must review the changes
done by the requestor. The following graphic shows you the process flow in a simplified way.
With the Rule-Based Workflow (RBW) you can model all forms of rejections, parallel processing, and more
complex flows. These are not part of this How To guide.
2. PREREQUISITES
- Guide was written on a SAP MDG 9.0 environment but should work starting with SAP MDG 7.0
- ABAP development skills
3. INTRODUCTION
3.1. STORY BOOK
At a company, existing suppliers can be changed easily using MDG-S Change Requests without any
approvals. A review by an additional approver is only required if the Bank details are changed by a
requestor. Only if the approver is convinced that the newly entered bank details or changes are correct will
he approve the change. This prevents possible fraud.
3.2. HIGH LEVEL STEPS
The implementation consists of 6 steps:
1. Configure new MDG Change Request Type with the Rule-Based Workflow template. This step is done
in the Master Data Governance implementation guide (mdgimg).
2. Implementation of the BADI
3. Create ABAP dictionary objects
4. Modeling BRF+ elements and the process flow in BRF+
5
How To... MDG-S: Dynamic Workflow Processing based on changes to bank details
4. STEP-BY-STEP EXPLANATION
4.1. Create new Change Request Type
1. Go to transaction mdgimg and navigate to General Settings Process Modeling Change
Requests and execute activity Create Change Request Type
3. Select the CR Type and choose Entity Types: Add new Entity Type: BP_Header
6
How To... MDG-S: Dynamic Workflow Processing based on changes to bank details
7
How To... MDG-S: Dynamic Workflow Processing based on changes to bank details
2. Choose New:
8
How To... MDG-S: Dynamic Workflow Processing based on changes to bank details
6. In the next popup select “Copy sample class”: This is an example from MDG-M and we will change it
later.
7. In the BAdI: define Filter Val.
9
How To... MDG-S: Dynamic Workflow Processing based on changes to bank details
10
How To... MDG-S: Dynamic Workflow Processing based on changes to bank details
11
How To... MDG-S: Dynamic Workflow Processing based on changes to bank details
12
How To... MDG-S: Dynamic Workflow Processing based on changes to bank details
13
How To... MDG-S: Dynamic Workflow Processing based on changes to bank details
14
How To... MDG-S: Dynamic Workflow Processing based on changes to bank details
15
How To... MDG-S: Dynamic Workflow Processing based on changes to bank details
16
How To... MDG-S: Dynamic Workflow Processing based on changes to bank details
Info:
- In Table DT_SINGLE_VAL_ZSUPBAN the first 2 lines are interesting: Dependent on the custom
condition the workflow is dynamically routed.
The example class in this How-To guide has the following methods:
17
How To... MDG-S: Dynamic Workflow Processing based on changes to bank details
- Methods:
o IF_USMD_SSW_RULE_CNTX_PREPARE~PREPARE_RULE_CONTEXT: This is the
method which is called by the MDG framework and can have these lines:
DATA: lv_brf_expr_id TYPE if_fdt_types=>id.
DATA: ls_context TYPE usmd_s_fdt_context_value.
DATA: lv_crequest TYPE usmd_s_crequest.
FIELD-SYMBOLS: <value> TYPE any.
* Prepare export parameters
CLEAR et_message.
CLEAR et_rule_context_value.
o GET_ELEMENT_ID: This method returns the ID of the element defined in the BRF+
application in former step
METHOD GET_ELEMENT_ID.
DATA:
lv_application_id TYPE if_fdt_types=>id,
lo_brf_factory TYPE REF TO if_fdt_factory,
lo_brf_query TYPE REF TO if_fdt_query,
lt_selection TYPE if_fdt_query=>ts_selection,
ls_selection LIKE LINE OF lt_selection,
ls_obj_category TYPE if_fdt_query=>s_object_category_sel,
lt_names TYPE if_fdt_query=>ts_name,
ls_names TYPE if_fdt_query=>s_name.
*-------------------------------------------------------------------
-*
18
How To... MDG-S: Dynamic Workflow Processing based on changes to bank details
type
ENDIF.
lo_brf_factory = cl_fdt_factory=>if_fdt_factory~get_instance( ).
ls_selection-queryfield =
if_fdt_admin_data_query=>gc_fn_application_id.
ls_selection-sign = 'I'.
ls_selection-option = 'EQ'.
ls_selection-low = lv_application_id.
INSERT ls_selection INTO TABLE lt_selection.
ls_obj_category-system_objects = abap_true.
ls_obj_category-customizing_objects = abap_true.
ls_obj_category-masterdata_objects = abap_false.
ENDMETHOD.
CLEAR: es_crequest.
* Get read-only access to USMD model data
CALL METHOD cl_usmd_model_ext=>get_instance
EXPORTING
i_usmd_model = if_mdg_bs_mat_gen_c=>gc_model_mm
IMPORTING
eo_instance = lr_model.
* Read the CR itself (to get the CR type)
ls_sel-sign = lc_incl.
19
How To... MDG-S: Dynamic Workflow Processing based on changes to bank details
ls_sel-option = lc_equal.
ls_sel-fieldname = usmd0_cs_fld-crequest.
ls_sel-low = iv_cr_number.
INSERT ls_sel INTO TABLE lt_sel.
CALL METHOD lr_model->read_char_value
EXPORTING
i_fieldname = usmd0_cs_fld-crequest
it_sel = lt_sel
if_use_edtn_slice = abap_false
IMPORTING
et_data = lt_crequest.
READ TABLE lt_crequest INTO es_crequest INDEX 1.
ASSERT sy-subrc = 0. " CR not found
endmethod.
o IS_BP_BKDTL_INCLUDED: This class returns if the MDG entity 'BP_BKDTL' was changed
within the CR. It uses another class to read the “staging” area content
METHOD is_bp_bkdtl_included.
DATA:
lt_all_staging TYPE usmd_ts_entity_data_all,
ls_all_staging TYPE usmd_sx_entity_data_all.
ENDMETHOD.
o READ_DATA: This method can be implemented by you to read all entities in staging
typically you use readmode “gc_readmode_no_act” to get only inactive/staging data.
Please use the MDG-API to retrieve this data.
4.6. Test
Step by Step guide for testing
Test 1: Change of existing customer including bank details Approval
Step 1: Requestor
- Login as requestor
- Go to MDG-S Search
- Search for an existing Business Partner
- Select the record in the result list and click on EDIT
- Select CR Type MDG-S: Dynamic Approval (Bank Demo) from CR Type List
20
How To... MDG-S: Dynamic Workflow Processing based on changes to bank details
Step 2: Approver
- Login as approver
- Go to MDG-S and page “My Change Requests”
- Review the list and you will see that the CR_ID from last step is in the list
- Open the MDG CR
- System informs you about changed Bank details by color highlighting
- Approve the CR
Test 2: Change of existing customer without changing bank details auto approval
Step 1: Requestor
- Login as requestor
- Go to MDG-S Search
- Search for existing Business Partner
- Select the record in the result list and click on change
- Select CR Type “MDG-S: Dynamic Approval (Bank Demo)” from CR Type List
- Change the Address (or any other) attribute.
- Do not change the bank details
- Submit your request
- Remember the CR ID:_____________
- Logoff from the NWBC
Step 2: Approver
- Login as approver
21
How To... MDG-S: Dynamic Workflow Processing based on changes to bank details
5. REMARKS
- This guide can also be used for all other kinds of dynamic routing; it is not limited to bank details only
- Due to the fact that the BP data model is used you can also use it for MDG-C and MDG-BP related
processes
- A more general guide on the BAdI USMD_SSW_RULE_CONTEXT_PREPARE is located here:
https://archive.sap.com/documents/docs/DOC-14881
- The Code in this Guide, SAP Code or application samples and tutorials are NOT FOR PRODUCTIVE
USE. You may not demonstrate, test, examine, evaluate or otherwise use them in a live operating
environment or with data that has not been sufficiently backed up. You may not rent, lease, lend, or
resell SAP code or application samples and tutorials.
22