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

  1. Get `CL_USMD_GOV_API` instance for model `0G`.
  2. Create the change request with the correct CR type and edition.
  3. Lock the target entity keys with `enqueue_entity`.
  4. Read active entity data with `read_entity` and merge it with incoming rows.
  5. Write the master data entity rows with `write_entity`.
  6. For hierarchy changes, read current parents with `MO_HRY_API->read_hry_parent_predec_gov`.
  7. Delete old hierarchy assignments and write the new assignment.
  8. 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

ObjectPurpose
CCTR / CCTRG / CCTRHCost Center master, group, and hierarchy entities.
PCTR / PCTRG / PCTRH / PCCCASSProfit Center master, group, hierarchy, and company-code assignment entities.
/mdg/_s_0g_pp_cctr / /mdg/_s_0g_pp_pctr / /mdg/_s_0g_pp_pcccassStandard 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?

Keywords

MDG-F0GCL_USMD_GOV_APIIF_USMD_GOV_APIMO_HRY_APICCTRPCTRCCTRGPCTRGCCTRHPCTRHPCCCASS/mdg/_s_0g_pp_cctr/mdg/_s_0g_pp_pctr/mdg/_s_0g_pp_pcccassread_entitywrite_entityenqueue_entitywrite_assignmentdelete_assignmentread_hry_parent_predec_gov