Introduction:
In Central Finance S/4 HANA,
MDG mapping plays an important role in replication process.
Mapping helps in defining the relation of different identifiers or objects like GL Account, Cost Centre, Company Code, etc. between source ECC systems and Central Finance. Mapping is read via Standard SAP functionality during replication. However, there is always requirement to read mapping in BADI during replication. There are different standard MDG classes used in Central Finance to read the MDG Mappings. This blog will focus on how to create ABAP CDS Views to read different types of MDG Mapping, for better performance and can be utilized for different integrations.
Approach:
Central Finance: MDG Mapping via CDS Views
There are two categories of MDG Mapping:
- Value Mapping
- Key Mapping
How to create ABAP CDS Views for Value Mapping?
A common CDS Views can be created to read the Value Mapping for all objects. Following tables can be used:
- FINS_CFIN_MDGME - CFIN: Definition of Mapping Entities (ID / Code)
- MDGD_CCODEMAP - Client-dependent Code Mapping
- MDGD_CMAPCONTEXT - Specifies Mapping Contexts of code-mapping(client dependent)
- MDG_BUS_SYS_TECH - Technical information of a Business System


Fields Usage:
MAPPING_ENTITY: MDG Mapping entity Name
LIST_AGENCY_ID: Business System
LOGSYS: Source Logical System
SRC_VAL: Source Value
TRG_VAL: Target Value
This CDS View can help in getting the mapping of all Standard and Custom Value Mappings, which are available in FINS_CFIN_MAP_MANAGE.
How to create ABAP CDS Views for Key Mapping?
In MDG Framework, key mapping tables are different for different mapping entities. In this case, we need to create CDS views per mapping entity.
Below is example of GL Account Key Mapping. Following tables can be used to get the GL Account Key Mapping:
- UKMDB_AGCGLAM0 – UKM: Key Agency (Business System Details with reference to Mapping entity)
- UKMDB_MGPGLAM0 - UKM: Positive Mapping Groups (Mapping key between source and target value
- UKMDB_KEYGLAM0 - UKM: Key (Stores the actual source and target values)
- UKMDB_SCHGLAM0 – Schema ID
- MDG_BUS_SYS_TECH – Business System to Logical System Mapping
GLAM0 is key which is identifier for GL Account Key Mapping. Prefix of table remain same and identifier varies from one mapping entity to other. For eg, Business Partner mapping table
UKMDB_AGCBNSS0,
UKMDB_MGPBNSS0,
UKMDB_KEYBNSS0,
UKMDB_SCHBNSS0. In this case, schema table UKMDB_SCHBNSS0 helps in identifying whether mapping is for vendors, customers, etc.
Below is an example CDS View creation of Key Mapping for GL Account:

Hidden Field in above screen is Central Finance
Business System and 907 is Identifier type for GL Account Mapping

Hidden Field in above screen is Central Finance
Business System and 907 is Identifier type for GL Account Mapping


Fields Usage:
BUSINESS_SYSTEM: Business System
LOGSYS: Source Logical System
KOKRS_SRC: Source Controlling Area
SAKNR_SRC: Source GL Account
BUKRS_SRC: Source Company Code
KOKRS_TRG: Target Controlling Area
SAKNR_TRG: Target GL Account
BUKRS_TRG: Target Company Code
Conclusion:
- MDG Value and Key Mapping can be read using CDS views in FI and CO replication BADI. This will improve performance during replication.
- For Reading mapping in BADI during replication, using Standard MDG Class/method increases chances of locking issue if same mapping entity is getting loaded at the same time. This can be avoided by using CDS Views.
- These CDS Views can be used in Custom RFC Function Module or RFC_READ_TABLE or Custom SOAP Service or PO Service. These can further be utilized in other applications outside SAP S/4 HANA Central Finance.
I hope this blog post was helpful for you!