Overview:
This blog will help to create/change the hierarchy assignment to respective MDG objects. Here we will be focussing on how to create the assignment of cost center to cost center group and cost center hierarchy through a program in MDG.
Prerequisite:
- Cost center hierarchy assignment change request type should be configured.
- Necessary authorizations should be provided to background user (SAP_WFRT) to create/change assignment
Process:
We will be creating a follow-up change request for cost center hierarchy assignment which will be triggered once main cost center change request is completed in the MDG system. Once main change request is completed use below logic in badi implementation USMD_SSW_SYSTEM_METHOD_CALLER. Get the required cost center, cost center group and cost center hierarchy to be assigned.
- Create a dummy change request using governance API (if_usmd_gov_api)
- Pass relevant edition using method set_crequest_edition
- Enqueue the change request using method enqueue_entity
- Check if cost center is already assigned to any cost center group using Hierarchy API (if_usmd_hry_api). If required delete the assignment using method delete_assignment
- Pass hierarchy key (Cost center hierarchy), parent key (Cost center group) and node key (Cost center)
- Enqueue the assignment using method enqueue_assignment
- Create the assignment using method write_assignment
- Check for errors using method check_crequest_data
- If no errors then dequeue the assignment using method dequeue_assignment
- Dequeue the change request using method dequeue_entity
- Perform COMMIT WORK AND WAIT.
- Start the workflow using method start_workflow
- Once new change request is completed, hierarchy assignment will be done in MDG system
Summary:
By following above steps you can create/change the hierarchy assignments using MDG APIs for your standard MDG objects like profit center hierarchy assignment, cost element hierarchy assignment etc. and also for custom MDG objects
Hope you will find this information useful.
Please like, share and comment.
If you have anything else please feel free to ask any question or add points.
Happy Learning!