SAP MDG · MDG FINANCE
How do I create and submit MDG-F Cost Center or Profit Center change requests with hierarchy maintenance in model 0G?
Use CL_USMD_GOV_API to create the CR, lock and write CCTR or PCTR data, maintain hierarchy via MO_HRY_API, then check, save, dequeue, and start workflow. For Profit Center, also write PCCCASS; for both objects, read active data first and merge before write.
Use CL_USMD_GOV_API to create the CR, lock and write CCTR or PCTR data, maintain hierarchy via MO_HRY_API, then check, save, dequeue, and start workflow. For Profit Center, also write PCCCASS; for both objects, read active data first and merge before write.
For MDG-F model `0G`, Cost Center uses `CCTR` with `CCTRG`/`CCTRH`, and Profit Center uses `PCTR` with `PCTRG`/`PCTRH` plus `PCCCASS`. The standard flow is: create the CR with `CL_USMD_GOV_API`, lock the involved entities, read active data, merge changes, write master and hierarchy data, then check, save, dequeue, and start workflow.
Process flow
- Get `CL_USMD_GOV_API` instance for model `0G`.
- Create the change request with the correct CR type and edition.
- Lock the target entity keys with `enqueue_entity`.
- Read active entity data with `read_entity` and merge it with incoming rows.
- Write the master data entity rows with `write_entity`.
- For hierarchy changes, read current parents with `MO_HRY_API->read_hry_parent_predec_gov`.
- Delete old hierarchy assignments and write the new assignment.
- Run `check_crequest_data` and `check_complete_data`.','Save the CR, dequeue entity locks, dequeue the CR, and commit.','Start workflow and commit again.'],
Referenced tables
| Object | Purpose |
|---|---|
CCTR / CCTRG / CCTRH | Cost Center master, group, and hierarchy entities. |
PCTR / PCTRG / PCTRH / PCCCASS | Profit Center master, group, hierarchy, and company-code assignment entities. |
/mdg/_s_0g_pp_cctr / /mdg/_s_0g_pp_pctr / /mdg/_s_0g_pp_pcccass | Standard staging structures used by the sample implementation. |
The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How can I programmatically create a Cost Center CR in MDG-F?
- How do I write Profit Center master data and company-code assignment into an MDG change request?
- How do I replace a hierarchy parent for CCTR or PCTR using standard MDG API?
Possible questions
- How do I create a Cost Center or Profit Center CR with CL_USMD_GOV_API?
- Which entities are used for MDG-F Cost Center and Profit Center hierarchy maintenance?
- How do I read active data and merge it before writing to an MDG CR?
- How do I remove an existing hierarchy assignment and write a new one in MDG-F?
- What are the standard staging structures for CCTR, PCTR, and PCCCASS?