Creating an Example Data Model
Example: Flight Customers
This example shows how a data model for flight customers is defined. The SFLIGHT example defines three related database tables: SCUSTOM, SBUSPART and STRAVELAG. For more information, see Flight Model.
Although the tables in this data model use the SAP namespace, the steps and requirements necessary for bringing the tables under governance are the same as those used in the customer namespace. The names of your entity types must be in the customer namespace. In this example, the table SBUSPART represents entity type ZSBUSPART. Since the governance process should be based on airline partners (table SBUSPART), ZSBUSPART shall be the entity type of storage and usage type 1. During this process, airline partners and travel agencies are created as well. Therefore, entity types need to be created. Since they are created only together with airline partners, these entity types need to have storage and usage type 4.
A key of the SCUSTOM table is the field ID. The field ID uses the check table SBUSPART. Therefore, ZSCUSTOM is defined as an entity type with storage and usage type 4 with a leading relationship to ZSBUSPART.
A key field of the table STRAVELAG is the field AGENCYNUM. The AGENCYNUM field uses the check table SBUSPART. Therefore, ZSTRAVLAG is defined as an entity type with storage and usage type 4 with a leading relationship to ZSBUSPART.
SCUSTOM : Flight Customers
Field | Data Element |
|---|---|
MANDT | S_MANDT |
ID | S_CUSTOMER |
NAME | S_CUSTNAME |
FORM | S_FORM |
STREET | S_STREET |
POSTBOX | S_POSTBOX |
POSTCODE | POSTCODE |
CITY | CITY |
COUNTRY | S_COUNTRY |
REGION | S_REGION |
TELEPHONE | S_PHONENO |
CUSTTYPE | S_CUSTTYPE |
DISCOUNT | S_DISCOUNT |
LANGU | SPRAS |
S_EMAIL | |
WEBUSER | S_WEBNAME |
SBUSPART: Airline Partner
Field | Data Element |
|---|---|
MANDANT | S_MANDT |
BUSPARTNUM | S_BUSPANUM |
CONTACT | S_CONTACT |
CONTPHONO | S_CPHONENO |
BUSPATYP | S_BUSPATYP |
STRAVELAG: Travel Agency
Field | Data Element |
|---|---|
MANDT | S_MANDT |
AGENCYNUM | S_AGNCYNUM |
NAME | S_AGNCYNAM |
STREET | S_STREET |
POSTBOX | S_POSTBOX |
POSTCODE | POSTCODE |
CITY | CITY |
COUNTRY | S_COUNTRY |
REGION | S_REGION |
TELEPHONE | S_PHONENO |
URL | S_URL |
LANGU | SPRAS |
CURRENCY | S_CURR_AG |
Data Modeling
In this process, you create entity types for SBUSPART, SCUSTOM, and STRAVELAG, their attributes, and the relationships between the entity types.
Create Data Model
Define the data model in Customizing for Master Data Governance
under .
Select the Data Models
view, choose New Entries
, and enter a new data model called YZ
with the description Airline Business Partner
.
Create Entity Types
Select the Entity Types
view, choose New Entries
, and make the following entries for the entity type ZSBUSPART
:
Fields | Entries | Comment |
|---|---|---|
Storage/Use Type | Changeable via Change Request; Generated Database Tables | Type-1 Entity Type |
Validity of Entity | No Edition | n.a. |
Data Element | S_BUSPANUM | Defines the key of the entity type and the field labels |
Hierarchies | No Hierarchies | n.a |
Validity/Hierarchy | Hierarchy is Not Edition Dependent | n.a. |
Key Assignment | Key Cannot Be Changed; No Internal Key Assignment | User needs to provide the key when creating new entities |
Deletion | Deletion Allowed | n.a. |
Description | Airline Partner | n.a. |
Leave all other fields of the entity type blank, which is the default.
Create a new entry for the type-4 entity type ZSCUSTOM
Fields | Entries | Comment |
|---|---|---|
Storage/Use Type | Changeable via Other Entity Type; Generated Database Tables | Type-4 Entity Type |
Validity of Entity | No Edition | n.a. |
Data Element | <BLANK> | Left blank for ZSCUSTOM as the key will be derived from the relationship to the leading entity type ZSBUSPART (see below) |
Hierarchies | No Hierarchies | n.a |
Validity/Hierarchy | Hierarchy is Not Edition Dependent | n.a. |
Key Assignment | Key Cannot Be Changed; No Internal Key Assignment | User needs to provide the key when creating new entities |
Deletion | Deletion Allowed | n.a. |
Description | Flight Customers | n.a. |
Create a new entry for the type-4 entity type ZSTRAVLAG
Fields | Entries | Comment |
|---|---|---|
Storage/Use Type | Changeable via Other Entity Type; Generated Database Tables | Type-4 entity type |
Validity of Entity | No Edition | n.a. |
Data Element | <BLANK> | Left blank for ZSTRAVLAG as the key will be derived from the relationship to the leading entity type ZSBUSPART (see below). |
Hierarchies | No Hierarchies | n.a |
Validity/Hierarchy | Hierarchy is Not Edition Dependent | n.a. |
Key Assignment | Key Cannot Be Changed; No Internal Key Assignment | User needs to provide the key when creating new entities |
Deletion | Deletion Allowed | n.a. |
Description | Travel Agencies | n.a. |
Note
If you save your data at this point, the check log shows various errors, which you can ignore at this time.
Enter the attributes of the entity types ZSBUSPART
, ZSTRAVLAG
, and ZSCUSTOM
. Select the entity type you want to process and navigate to the Attributes
view.
Choose New Entries
and enter the following attributes and data elements for entity type ZSBUSPART
:
Attribute | Data Element |
|---|---|
BUSPATYP | S_BUSPATYP |
CONTACT | S_CONTACT |
CONTPHONO | S_CPHONENO |
Leave all other fields of the attributes blank, which is the default.
Note
Data in MDG is always client dependent. Therefore, the MANDT field is not modeled as an attribute.
Choose New Entries
and enter the following attributes and data elements for the entity type ZSTRAVLAG
:
Attribute | Data Element |
|---|---|
CITY | CITY |
COUNTRY | S_COUNTRY |
CURRENCY | S_CURR_AG |
NAME | S_AGNCYNAM |
POSTBOX | S_POSTBOX |
POSTCODE | POSTCODE |
REGION | S_REGION |
STREET | S_STREET |
TELEPHONE | S_PHONENO |
URL | S_URL |
ZLANGU | SPRAST |
MDG uses the value table of the domain as defined in the data element of the attribute. This lets you perform checks and call up input help in the user interface.
In transaction SE11, you can see that the attribute LANGU with the data element SPRAS is used in the data dictionary (DDIC) table STRAVELAG. This cannot be reflected in the MDG data model. The attribute name LANGU cannot be used. Therefore, the name ZLANGU is used. The data element SPRAS cannot be used as well, but it can be replaced by SPRAST. The attribute names MANDT, SID, TXTLG, TXTMI, and TXTSH cannot be used as well.
Choose New Entries
and enter the following attributes and data elements for the entity type ZSCUSTOM
:
Attribute | Data Element |
|---|---|
SCITY | CITY |
SCOUNTRY | S_COUNTRY |
SCUSTTYPE | S_CUSTTYPE |
SDISCOUNT | S_DISCOUNT |
SEMAIL | S_EMAIL |
SFORM | S_FORM |
SLANGU | SPRAST |
SPOSTBOX | S_POSTBOX |
SREGION | S_REGION |
SSTREET | S_STREET |
STELEPHON | S_PHONENO |
SWEBUSER | S_WEBNAME |
Attributes such as CITY can only be assigned once to a type-1 entity type. Therefore, you have to rename the attributes of entity type ZSCUSTOM. This is also true for indirect assignments that involve leading type-4 entity types. When renaming, insert an S as the prefix.
Create Relationships
Select the Relationships
view, choose New Entries
, and enter the following relationship details:
From-Entity Type | Relationship | To-Entity-Type | Relationship Type | Cardinality |
|---|---|---|---|---|
ZSBUSPART | BUSP2CUST | ZSCUSTOM | Leading | 1:1 |
ZSBUSPART | BUSP2TRAV | ZSTRAVLAG | Leading | 1:1 |
Leave all other fields of the relationships blank, which is the default.
Save and Activate the Data Model
First, you need to save the data model. This will automatically perform a check. For the data in this example data the warning messages, which are related to change documents. Now activate the data model.
You can choose Visualize Data Model
to display an overview.