Indu Learning Platform
Course/Unit 1 · MDG from the engine room
Lesson 1-2

The data model, entity by entity

Entity types, storage and use types, relationships and generation: the vocabulary behind every MDG design discussion and every generated table.

Watch firstEntity Types and Relationships | Class 5 | SAP MDG · TechOpen on YouTube ↗

Everything hangs off the model

UI configuration, change request types, BRFplus checks, staging tables and replication mapping are all configured against the data model. SAP delivers BP, MM and 0G (financial objects); custom models usually start with Z. Read the model as a schema definition: changing it changes generated database objects.

Data model (BP, MM, 0G, Z*)Entity typesAttributesKey fieldsStorage & use typeRelationshipsLeadingQualifyingReferencingCardinalityHierarchiesParent–childHierarchy versionsEditionsTime validityMainly 0GGenerated objectsStaging tablesStructuresFlex active tables
The skeleton every other MDG setting refers to.

Entity types and attributes

An entity type is roughly a table with attributes (fields typed by data elements) and a key. Custom fields arrive as a model extension. In reuse mode the field must also exist in the target table (an append on LFA1, say) and be mapped; in flex mode MDG generates the storage. Same thinking as a Migration Cockpit field mapping.

Entity typeModelLevelTypical keyBP_HEADERBPPartnerBusiness partner numberADDRESSBPPartner addressBP + address numberMATERIALMMClientMaterial numberMARCBASICMMPlantMaterial + plantCCTR0GControlling areaControlling area + cost center
SAP-delivered examples. Names can differ by release.

The four storage and use types

Each entity type answers two questions: does MDG own this data, and can a change request change it? Getting it wrong is expensive: a reference modelled as type 1 invites governance of data nobody owns.

Step through · 1 of 6
Is it changed inMDG?No → Type 3reference onlyOwn change request?Own key → Type 1e.g. BP, materialDepends on type 1 →Type 4e.g. plant dataChanged via other →Type 2check / text tables
Start with ownership. If the business never maintains it in MDG, it is a reference.
Step through the questions when you design a new entity type.

Try it: match the storage and use type

Try it · Match

Match each storage and use type to its description.

Pick an item on the left, then its match on the right.

Relationships and cardinality

Leading makes one entity part of another's key (plant data cannot exist without the material). Qualifying adds a key part from another entity. Referencing checks an attribute against another entity, like a cost center's company code. Cardinality (1:N, 1:1) drives the UI and validation: "exactly one remit-to address" is a cardinality requirement.

From entityTo entityMATERIALMATERIALMARCBASICCCTRBP_HEADERMARCBASICMAKT-like textPlant (type 3)Company code (type 3)ADDRESSleading 1:Nleading 1:Nqualifyingreferencingleading 1:N
Leading builds the key, qualifying adds key parts, referencing checks a value.

Try it: which relationship?

Try it · Sort

Sort each requirement into the relationship type that models it.

Leading
Qualifying
Referencing
Click an item, then a bucket (or drag it).

A model change is a code change

Activating a data model generates staging tables, structures and, for flex entity types, active-area tables. After a change you regenerate, adjust UI configurations, review BRFplus checks and check replication mapping. Transport it, test with real CRs in flight, and never change keys of an entity with data without a migration plan.

Designentity, type,relationshipsEdit modelMDGIMG Data ModelingActivate &generate/1MD/ objectsMap & extendSMT, append structuresUI & rulesFPM config, BRFplusReplicationoutbound mappingTransport & testopen CRs too
Adding one custom attribute, end to end.

Try it: model facts

Try it · Fill the blanks

Complete the facts about editing and generating a data model.

Edit the model in MDGIMG → General Settings →  → Edit Data Model. Activation generates  tables in the  namespace, and for  entity types the active-area tables too. In reuse mode, a custom supplier field also needs an  on LFA1.

Reading model data in ABAP

Use the model API so code reads staging or active data the way the framework does, without hard-coding generated table names. For read-only analytics on reuse-mode data, CDS views such as I_BusinessPartner or I_Product are often simpler.

ABAP
DATA lo_model TYPE REF TO if_usmd_model_ext.

" 1. Get the model instance for data model BP
cl_usmd_model_ext=>get_instance(
  EXPORTING i_usmd_model = 'BP'
  IMPORTING eo_instance  = lo_model ).

" 2. Build a selection: entity BP_HEADER, key = partner number,
"    staging (with CR number) or active data
" 3. Call the read method (for example READ_CHAR_VALUE)
" 4. Process the result generically: the structure is generated

Outline only. Verify method signatures for your release in SE24.

Let an assistant document the model

Export entity types and relationships, then ask for a data dictionary. Give it the raw export, not your memory.

text
Attached: two CSV exports from MDG data model ZSUP
(entity types with storage/use type; relationships with cardinality).
1. Produce a data dictionary: entity, type 1-4, key fields,
   parent entity, purpose (one line, mark GUESS if unclear).
2. List entities whose storage type looks inconsistent with
   their relationships, and say why.
3. Do not invent entities or fields that are not in the files.

Attach the exported entity and relationship lists.

Remember

  • Entity types, attributes and relationships form the data model; almost everything else is configured against it.
  • Storage and use type answers: does MDG own it, and can a change request change it?
  • Activating a model generates objects; plan model changes like code changes, including open change requests.

Check yourself

A country entity you only reference and never change in MDG is usually storage and use type…
What links a cost center entity to its company code so that only valid company codes can be entered?
Plant-level material data that is changed in the material's change request is best modelled as type…
You add a custom field to supplier data in reuse mode. Which extra step is needed compared with flex mode?