This is a continuation of blog<
Integrate SAP Commercial Project Planning with any CRM application> by our product owner Ravindranath Nayak. You are now all set to try out integrating your CRM system with SAP CPM?
Let me outline some building blocks and necessary APIs for integrations. These APIs are available from S/4 Hana 1709.
Prerequisite: Your CRM system opportunity has been enhanced to store information of CPM commercial project.
Create Commercial Project for Opportunity.
At a certain stage of opportunity, you would like to create Commercial Project in CPM with reference to Opportunity in CRM. You may also like to utilize the planning functionality available in CPM. So, this blog explains how the commercial project and commercial (financial) plans are created with linking to CRM opportunity and Opportunity line items.
One can use SAP CPM API ‘/CPD/CREATE_MP_FP_FROM_REL_OBJ’. You may want to generate asynchronous web service out of this API for consumption with SAP HANA cloud integration.
This API is an RFC function module which creates a commercial project based on details passed in the following parameters:
This function module also creates one or more commercial(financial) plans for the commercial project, based on the items of the Opportunity passed in the parameter IT_MP_ITEM_REL. In the commercial(financial) plan, a bid structure element is created and mapped to the respective item of the Opportunity linked to the commercial project.
Here, some more information about additional parameters
IT_MP_ITEM_HDR
IT_MP_ITEM_REL
Now you may want to update Commercial project Id within CRM system. This can be done using below attributes.
This data can be used in further APIs to get the data stored or planned in the CPM for the commercial (financial) plans.
What if I would like to default certain attributes based on information from opportunity?
The following business add-ins [extensibility points] can be used
- /CPD/PWS_MP_DEFAULTS – To default certain values for Commercial Projects
- /CPD/PFP_BADI_FP_DEFAULTS – To default certain values for Commercial Financial Plans
Within standard system, default implementation of /CPD/CL_PFP_FP_DEFAULTS creates one commercial(financial) plan for every opportunity line item. On the other hand, if you want to change the financial plan creation from 1:1 to any other scenario, that is one financial plan for multiple opportunity line items. You must create your own implementation of this BAdI.
You can use importing parameters to set the mandatory information for a financial plan, or allow the implementation to determine these values from the reference object.
Now you may want to show information about commercial plans within CRM system such as costs, revenues & margin or various versions.
You can use following APIs
API /CPD/PFP_RFC_GET_AGGR_COST – Get plan cost and revenue at aggregated level. You would need to pass Commercial Project ID that was stored after successful creation of Commercial project.
API /CPD/PFP_RFC_REFOBJ_TRANSFER – Get detailed commercial plan data for the versions specified in IT_PLAN. The function module reads plan data for a plan version of a financial plan belonging to a commercial project.
What if I would delete the opportunity line item and want to delete the reference in the commercial plan?
The API /CPD/PFP_RFC_DEL_REF_OBJ_LINK - Delete assignments between bid structure elements and opportunity line items, when they are deleted from the opportunity linked to the commercial project. This RFC can be configured in a synchronous way from CRM.