SAP MDG · MDG FINANCE
How do I create MDG-F Cost Center, Profit Center, and G/L Account change requests programmatically with the standard governance API?
Use CL_USMD_GOV_API / IF_USMD_GOV_API with model 0G: get the API instance, create the change request, enqueue the relevant entities, read and merge active data for change scenarios, write entity data, check, save, dequeue, and start workflow. For Cost Center use CCTR/CCTRH/CCTRG; for Profit Center add PCTR/PCTRH/PCTRG and PCCCASS; for G/L Account use ACCOUNT and ACCCCDET.
Use CL_USMD_GOV_API / IF_USMD_GOV_API with model 0G: get the API instance, create the change request, enqueue the relevant entities, read and merge active data for change scenarios, write entity data, check, save, dequeue, and start workflow. For Cost Center use CCTR/CCTRH/CCTRG; for Profit Center add PCTR/PCTRH/PCTRG and PCCCASS; for G/L Account use ACCOUNT and ACCCCDET.
The standard MDG-F approach is to use `CL_USMD_GOV_API` / `IF_USMD_GOV_API` for model `0G`, create the CR, lock the relevant entities, write the data, validate, save, dequeue, and then start workflow. For change or extend scenarios, read the active entity data first and merge your changes before `write_entity`.
Process flow
- Choose the MDG-F object and entities (CCTR/CCTRH/CCTRG, PCTR/PCTRH/PCTRG/PCCCASS, or ACCOUNT/ACCCCDET).
- Build the key and payload internal tables from source data.
- Create the change request with `create_crequest`.
- Enqueue the entity data using `iv_lock_mode = 'E'` and `iv_scope = '1'`.
- If this is a change or extend scenario, read the active data and merge it before writing.
- Write the entity or assignment data to the CR.
- Run `check_crequest_data` and `check_complete_data`.
- Call `save`, then dequeue the entity and CR, and commit the work.
Referenced tables
| Object | Purpose |
|---|---|
CSKS | Cost center source data table in the source sample. |
CSKT | Cost center text source table in the source sample. |
CEPC | Profit center source table in the source sample. |
CEPC_BUKRS | Profit center company-code assignment source table in the source sample. |
CEPCT | Profit center text source table in the source sample. |
USMD_T_MESSAGE | Governance API message table used for returned messages. |
USMD_T_ASSIGNMENT | Hierarchy assignment structure used for Cost Center hierarchy handling. |
The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How can I build a standard IF_USMD_GOV_API-based change request for cost center or profit center in MDG-F?
- What is the standard ABAP pattern to create an MDG 0G change request and write entity data?
- How do I create a G/L account change request in MDG Financials using CL_USMD_GOV_API?
Possible questions
- Which MDG-F entities are used for Cost Center, Profit Center, and G/L Account CR creation?
- What is the standard sequence for create, enqueue, write, check, save, dequeue, and start workflow in MDG-F?
- How do I adapt a Cost Center CR sample to Profit Center or G/L Account?
- How do I merge active data before writing a change request for an MDG-F change scenario?
- What workflow and lock handling is used with IF_USMD_GOV_API?