How-To Extend Master Data Governance For Material by A New Entity Type (Custom Z-Table, Reuse Option) V9.0
How-To Extend Master Data Governance For Material by A New Entity Type (Custom Z-Table, Reuse Option) V9.0
Applicable Releases:
From EhP6 for SAP ERP 6.0 and from S/4HANA 1511
Version 9.0
June 2023
Document History
© 2023 SAP SE or an SAP affiliate company. All rights reserved. See Legal Notice on www.sap.com/legal-notice for use terms, disclaimers, disclosures, or restrictions related to SAP Materials for general audiences.
How-To: Extend MDG-M by a New Reuse Entity Type
3
How-To: Extend MDG-M by a New Reuse Entity Type
1. Business Scenario
SAP Master Data Governance for Material (MDG-M) provides business processes to find, create, change,
and mark material master data for deletion. It supports the governance of material master data on a central
hub and the distribution of material master data to connected operational and business intelligence
systems.
The processes are workflow-driven and can include several approval and revision phases, and the
collaboration of all users participating in the master data maintenance.
Domain-specific content (data models, user interfaces, workflows) is provided as part of the standard for
several application areas. It is a common requirement from customers to adapt the MDG data models to their
specific needs.
The model MM is preconfigured with one reuse area called MATERIAL. This reuse area points to the access
class CL_MDG_BS_MAT_ACCESS, which can handle most fields of the pre-delivered Material Master in ERP
or S/4HANA.
This guide describes how to extend the preconfigured content of Master Data Governance for Material (using
the data model MM) by adding a new entity type that already exist as database fields. The attribute values of
the new entity type will be copied to the corresponding customer tables (reuse option) after activation of the
change request by using BAdI MDG_BS_MAT_API_SEGMENTS_EXT.
4
How-To: Extend MDG-M by a New Reuse Entity Type
2. Scenario
The following explanation shows you how to add the new entity type Business Partner Details to save
Business Partner nicknames for materials as part of the MDG-M data model
Figure: Data Model – Material (Scope of 2011 Delivery) with custom entity type “Business Partner Details”
3. Background information
In MDG, the data model is a central part of the application. SAP delivers several preconfigured data models
that you can start using with little configuration.
Looking at the Material object type and its related data in an abstract way, you can distinguish the following
categories of data fields:
• Identifying Material Data ~ 10 fields
• Descriptive Material Data ~ 100 fields
• Process Controlling Material Data ~ 1.000 fields
MDG for material data focuses on the main identifying, descriptive attributes and process controlling data of
the Material Master.
It is important to understand that MDG not only delivers the data fields in a model, but also comes with the
standard business rules to check for completeness and consistency. These checks are only enforced when
necessary in the process.
The delivered standard data model is MM. (This model is linked to the material business object ID: 194. It is
also linked to the change request business object type: BUS2550.). You can view the SAP delivered data
model in Customizing for Master Data Governance under General Settings > Data Modeling > Edit Data
Model.
The MM data model content for the different releases can be found in SAP Note 3134600.
5
How-To: Extend MDG-M by a New Reuse Entity Type
Additional Information:
• A BAdI is available for data enhancement during change request activation
(MDG_BS_MAT_API_ENRICH)
• Authorization Concept: Depend on the reuse of backend logic and pre-delivered roles defined in
PFCG
• Field control: visibility and mandatory fields are controlled with the field control feature that re-uses the
backend logic and existing settings (T130F).
Changeable via The master data of this storage and use type can be changed in Master Data
Change Request; Governance with a change request. The system generates all necessary
Generated Database database tables: check and text tables as well as additional tables, for
Tables (Type 1) example, for attachments and sets. The common key fields of these tables
are:
Furthermore, all tables contain a checkbox that indicates whether the master
data record is active. Depending on the workflow template used, it is possible
that a master data record is not set to active until the change request in which
the record was created or changed is released.
The settings you make for the entity type (such as language dependency)
result in additional key fields in the text table and the tables for attachments and
6
How-To: Extend MDG-M by a New Reuse Entity Type
sets.
The non-key fields contained in the text table are the entity texts. The non-key
fields contained in the check table are the attributes of the entity type. The
attachment and set tables contain predefined non-key fields. Furthermore, all
database tables contain a checkbox that indicates whether the master data record
was deleted. The check table also contains attributes that record which user
created or changed the data records and when this was done.
Changeable without The master data of this storage and use type can be changed in Master Data
Change Request; Governance without a change request. The system generates only the check
Generated and text tables with the entity type as well as with the entity types assigned to
Check/Text Tables the entity type through leading relationships as fixed key fields.
(Type 2)
The non-key fields contained in the text table are the entity texts. The check table
does not contain non-key fields.
The master data of this storage and use type cannot be changed in Master Data
Not Changeable via
Governance. Therefore, the system does not generate database tables. Instead,
MDG; No Generated
the system derives the available values from the domain that is assigned to the
Tables (Type 3)
data element – either from the assigned value table or from the domain fixed
values
The master data of this storage and use type can be changed in Master Data
Changeable via Other
Governance only with a change request of an entity type with storage and use type
Entity Type;
1. The entity type needs to be in a relationship with the relationship type leading
Generated Database
and assigned as the To-Entity type to an entity type with storage and use type 1.
Tables (Type 4)
The system generates the check table as described for storage and use type 1,
but also generates the entity types that are assigned through qualifying
relationships as key fields. The system does not generate a text table,
attachments, or sets since entity texts are not allowed for entity types with this
storage and use type.
You can view the settings for storage and use type for existing entity types in Customizing for
Master Data Governance under General Settings > Data Modeling > Edit Data Model. You
select the MM data model and double click on Entity Types (view cluster VC_USMD001). In the
list of entity types you can double click an entity type to view its details as shown below for
entity type MATERIAL.
The table below gives you some criterions for the decision between storage and use type 1 and 4.
Criterion Type1 Type4
Cross-dependencies Need to handle dependencies Easy to implement
between Type1 entities (include
into CR, blocking, …)
Parallel CRs Not needed Necessary if two Type4 entities for same Type1
entity shall be maintained independently
Snapshot Independent Together with corresponding Type1 entity and all
other Type4 entities ( Performance)
Enqueue This entity plus corresponding This entity, corresponding parent entity and all its
Type4 entities child entities
Authorization Own authorization objects Depends on authorization object of Type1 entity
(plus maybe additional own ones)
Implementation effort Own access class BAdI MDG_BS_MAT_API_SEGMENTS_EXT (lean, no
CD mapping, enqueue, Query, …) or own access
class
Mass Maintenance OK Not possible (exception: 1:1 Relationship)
7
How-To: Extend MDG-M by a New Reuse Entity Type
Important
For more complex requirements like search, mapping, change documents, field properties,
authorization, locks or derives, you need to provide an own access class by implementing
interface if_usmd_pp_access instead of using MDG_BS_MAT_API_SEGMENTS_EXT BAdI.
This guide only describes the usage of the BAdI MDG_BS_MAT_API_SEGMENTS_EXT.
The following options are possible for the relationship between two entity types:
Cardinality Definition
0:N This cardinality represents an optional relationship in which any number To-
Entity Types can be assigned to a From-Entity Type.
Note
Which relationship types are permitted depends on the storage and use types of the entity types. The
general design assumption is that there is a 1:N relationship between a database table and its entity
types. This means one entity type does not bundle several database tables.
8
How-To: Extend MDG-M by a New Reuse Entity Type
For optimal integration into SAP Business Suite, MDG provides the following two persistence modes:
• Generated active area (flex mode): Tables as defined in the MDG data model are
used to store active data.
• Reuse active area (re-use mode): Existing structures of applications are used. For
example, MDG for material makes use of the MARA table.
9
How-To: Extend MDG-M by a New Reuse Entity Type
10
How-To: Extend MDG-M by a New Reuse Entity Type
If you extend the data model by a new entity type and want the data of that entity type to remain
in the MDG tables after activation you can choose MDG as a reuse area.
The table below gives you some criterions for the decision between flex or reuse mode.
11
How-To: Extend MDG-M by a New Reuse Entity Type
Note
Value table on domain without foreign key assignment (for flex entities) is not supported out of the
box.
In the context of MDG, you typically choose to customize the SAP delivered configuration.
Only if customizing is not feasible do you copy the SAP delivered UI configuration to the
12
How-To: Extend MDG-M by a New Reuse Entity Type
Note
For more details regarding options for Floorplan manager user interface adaptation, advantages,
disadvantages, and steps required please familiarize yourself with SAP Note 1619534. See also How To Guide
for the UI Extend MDG-M User Interface.
13
How-To: Extend MDG-M by a New Reuse Entity Type
execution instructions.
Figure: Implementation steps for re-use Entity-Type extension
14
How-To: Extend MDG-M by a New Reuse Entity Type
In transaction SE11
1.
create table
YMDGM_BUPA00 as
shown.
In transaction SE11
2.
create structure
YMDGM_BUPA01_S
as shown.
In transaction SE11
3.
create table type
YMDGM_BUPA01_T
as shown.
15
How-To: Extend MDG-M by a New Reuse Entity Type
In transaction SE11
6.
create structure
YMDGM_BUPA01_S_
X as shown.
Note:
DELETE_ROW
indicates that this row
shall be deleted
16
How-To: Extend MDG-M by a New Reuse Entity Type
In transaction SE11
7.
create table type
YMDGM_BUPA01_T_X
as shown.
17
How-To: Extend MDG-M by a New Reuse Entity Type
Choose Display.
18
How-To: Extend MDG-M by a New Reuse Entity Type
19
How-To: Extend MDG-M by a New Reuse Entity Type
Important naming
convention:
<Tablename>_TAB
for the data part and
<Tablename>_X_TAB
for the change structure
with <Tablename>
being the name of the
database table you
want to put under
governance.
From MDG 9.0:
6.
Repeat step 1-5 for
backend structure
CMD_BS_MAT_S_
MAT_DATA.
In MDG customizing
1.
start the selected
entry as shown.
20
How-To: Extend MDG-M by a New Reuse Entity Type
21
How-To: Extend MDG-M by a New Reuse Entity Type
22
How-To: Extend MDG-M by a New Reuse Entity Type
The IS_SELECTION
1.
parameter contains
the material selection
criteria for which the
database select must
be executed.
The selection criteria
always contain the
MATNR and possibly
additional key fields
of the customer-
specific database
table.
Start transaction
3.
SE11.
Create the range table
type that looks like
shown in the screen
shot.
23
How-To: Extend MDG-M by a New Reuse Entity Type
Start transaction
4.
SE11.
Open structure
MDG_BS_MAT_S_MA
T_SELECTION.
Create an append
called
ZMDG_BS_MAT_RANG
E which has a
component called
BUPA_ID_RANGE of
component type
YBUPDA_GUID_T_RA
NGE.
The APPEND structure
is shown and the
structure
MDG_BS_S_MAT_SEL
ECTION
It is vital that the component name of the append adheres to the naming standard
<KEY-FIELDNAME OF BACKEND TABLE>_RANGE.
In our case the backend table is YMDGM_BUPA00 and the key-fieldname is
BUPA_ID therefore the component name is BUPA_ID_RANGE.
24
How-To: Extend MDG-M by a New Reuse Entity Type
25
How-To: Extend MDG-M by a New Reuse Entity Type
METHOD if_mdg_bs_mat_api_segments_ext~check_and_save.
CLEAR et_message.
First some checks
LOOP AT is_data-ymdgm_bupa00_tab INTO ls_data.
" All fields must be filled, otherwise MESSAGE e000(00) WITH ls_data-
matnr ls_data-bupa_id ls_data-nickname.
IF ls_data-matnr IS INITIAL OR ls_data-bupa_id IS INITIAL OR ls_data-
nickname IS INITIAL.
ls_message-msgid = '00'.
ls_message-msgno =
'000'. ls_message-msgty
= 'E'.
ls_message-msgv1 = 'Empty value detected in:
'. ls_message-msgv2 = ls_data-matnr.
ls_message-msgv3 = ls_data-bupa_id.
ls_message-msgv4 = ls_data-nickname.
INSERT ls_message INTO TABLE
et_message.
ENDIF.
" BuPa must
exist
" ...
ENDLOOP.
In test mode, we're finished now
CHECK iv_test_mode =
abap_false.
Determine which records to delete or to insert/update
LOOP AT is_data-ymdgm_bupa00_x_tab INTO ls_data_x.
IF ls_data_x-delete_row = abap_true. " Keep key fields for deletion
ls_delete-matnr = ls_data_x-matnr.
ls_delete-bupa_id = ls_data_x-
bupa_id. INSERT ls_delete INTO TABLE
lt_delete.
ELSE.
READ TABLE is_data-ymdgm_bupa00_tab INTO
ls_data WITH TABLE KEY matnr = ls_data_x-
matnr
bupa_id = ls_data_x-
bupa_id.
ASSERT sy-subrc = 0. " No _x record without data record
MOVE-CORRESPONDING ls_data TO
ls_modify. INSERT ls_modify INTO TABLE
lt_modify.
ENDIF
.
ENDLOOP
.
Now change the DB
Note: In a productive implementation, these DB changes must be done ON
COMMIT (PERFORM xxx ON COMMIT or CALL FUNCTION xxx IN UPDATE TASK)
* Note: We are basically ignoring the _X structure here - if data gets
changed, all fields get updated
IF NOT lt_delete IS INITIAL.
DELETE ymdgm_bupa00 FROM TABLE lt_delete.
26
ENDIF.
IF NOT lt_modify IS INITIAL.
MODIFY ymdgm_bupa00 FROM TABLE lt_modify.
How-To: Extend MDG-M by a New Reuse Entity Type
27
How-To: Extend MDG-M by a New Reuse Entity Type
28
How-To: Extend MDG-M by a New Reuse Entity Type
2. In the Configuration
Workbench open
the MM Data
Model.
29
How-To: Extend MDG-M by a New Reuse Entity Type
30
How-To: Extend MDG-M by a New Reuse Entity Type
Choose Save.
6.
Choose OK in the
confirmation dialog.
Choose Save.
8.
Choose OK in the
confirmation dialog.
31
How-To: Extend MDG-M by a New Reuse Entity Type
Go back to entity
9.
type YBUPA01.
Switch the
Attributes tab.
Choose Save.
11.
Choose OK in the
confirmation dialog.
32
How-To: Extend MDG-M by a New Reuse Entity Type
33
How-To: Extend MDG-M by a New Reuse Entity Type
To check the
15.
activated data
model, open the Edit
Data Model
Customizing activity
as shown.
Note
In general, if you change a data model (for example, if you change attributes of entity types or
relationships); you must regenerate the structures.
34
How-To: Extend MDG-M by a New Reuse Entity Type
In MDG customizing
1.
start Generate Data
Model-Specific
Structures.
- Text Buffer
- Search Help Buffer
- SMT-Mapping Data Buffer
- SPI Metadata Buffer
35
How-To: Extend MDG-M by a New Reuse Entity Type
You should use this report after extending the data model to make sure that the metadata is
consistent with the MDG customizing and UI configuration.
Important
When the mappings are saved the corresponding coding is generated. Make sure that all relevant structures are
ready before you start.
36
How-To: Extend MDG-M by a New Reuse Entity Type
37
How-To: Extend MDG-M by a New Reuse Entity Type
Z_MAP_YBUPA00_2
STA
Create a new
7.
mapping step
MAP_YBUPA01 as
shown. Source
structure is
YMDGM_BUPA01_S,
Target structure
ZMM_S_MM_PP_YBUP
A01.
Select your mapping
8.
step and choose the
Details pushbutton.
Open the
9.
Transformations tab.
38
How-To: Extend MDG-M by a New Reuse Entity Type
39
How-To: Extend MDG-M by a New Reuse Entity Type
Choose Add to
4.
create new mapping
step using the
details shown in the
screenshot.
Source structure is
ZMM_S_MM_PP_YBU
PA01, change
structure is
40
How-To: Extend MDG-M by a New Reuse Entity Type
YMDGM_BUPA01_S_
X, target structure is
YMDGM_BUPA01_S.
Choose the Change
5.
Structure Keys
pushbutton. Then
add the key fields of
the change
structure, as shown.
Select your
7.
mapping step and
choose the Details
pushbutton.
41
How-To: Extend MDG-M by a New Reuse Entity Type
Open the
8.
Transformations
tab.
42
How-To: Extend MDG-M by a New Reuse Entity Type
43
How-To: Extend MDG-M by a New Reuse Entity Type
Open
2.
configuration
FPM_LIST_UIB
B_T EMPLATE.
44
How-To: Extend MDG-M by a New Reuse Entity Type
Choose the
3.
Start
Configuration
pushbutton.
Choose the
4.
Copy
icon.
Enter a name
5.
for the copy as
shown.
45
How-To: Extend MDG-M by a New Reuse Entity Type
Refresh the
6.
navigation tree
and open the
new
configuration.
Choose the
7.
Start
Configuration
pushbutton.
Choose to
8.
continue in
change mode.
46
How-To: Extend MDG-M by a New Reuse Entity Type
Under General
9.
Settings choose
the Feeder
Class
pushbutton.
To confirm,
11.
choose
Yes.
47
How-To: Extend MDG-M by a New Reuse Entity Type
48
How-To: Extend MDG-M by a New Reuse Entity Type
Node name
13.
verification: if
you’re unsure
about the node
name, run
transaction MDB,
enter ABB ID
MDG_MAT and
you will get the
available nodes
49
How-To: Extend MDG-M by a New Reuse Entity Type
50
How-To: Extend MDG-M by a New Reuse Entity Type
51
How-To: Extend MDG-M by a New Reuse Entity Type
Open the
2.
configuration
BS_MAT_OVP.
52
How-To: Extend MDG-M by a New Reuse Entity Type
Choose to
4.
continue in
display mode.
Navigate to the
5.
configuration
BS_MAT_OVP_LA
YO UT.
Select Other
6.
Functions ->
Enhance.
Or you can
create a new
CBA or you can
use customizing
mode.
Provide a name
7.
for your
enhancement.
53
How-To: Extend MDG-M by a New Reuse Entity Type
Create a new
10.
wire entry with
the details shown
in the screenshot.
Use connector
class
PLMU/CL_FRW_W_
CONN_DEFAULT.
Save your
11.
changes.
54
How-To: Extend MDG-M by a New Reuse Entity Type
You should use this report after extending the data model to make sure that the metadata is
consistent with the MDG customizing and UI configuration.
55
How-To: Extend MDG-M by a New Reuse Entity Type
Alternatively, start transaction PFCG, enter role name SAP_MDGM_MENU* and click the Display pushbutton.
Select the Menu tab. In the hierarchy window, navigate to Role Menu -> Material Governance -> Material
Processing. Right click on Create Material and select Execute from the drop-down
56
How-To: Extend MDG-M by a New Reuse Entity Type
6. Additional Information
Related Information
• Learn more: Floorplan Manager for Web Dynpro ABAP | How to Adapt FPM | FPM Blog | How-to
Information | Service Mapping Tool |
57