Skip to Content
Technical Articles
Author's profile photo Nikhil Walsetwar

Transfer Custom Field’s Data between SAP C4C and SAP CPQ

In any business scenario, we create custom fields to map an additional data into the system. And in most of the cases, we need to transfer these custom fields data between multiple systems. In this blog-post, I’ll demonstrate how we can enhance the standard C4C + CPQ integration to send custom field’s data from SAP C4C to SAP CPQ and vice versa.

For this, let’s consider a scenario – A sales quote has a custom field on quick create screen(in C4C) which indicates the winning probability of the sales quote and we need to send this field’s data to SAP CPQ’s custom field ‘Winning Probability’.

This enhancement is divided into 3 sections based on the system as –

  1. Configuration in SAP C4C
  2. Configuration in SAP CPQ
  3. Configuration in SAP CPI (formally known as SAP HCI)

 

1. Configuration in SAP C4C

1.1. Create a custom “Short Text” field in SAP C4C named ‘Winning Probability’

1.2. Add this field to standard OData Service ‘cpquote’

1. 3. Add this field to standard SOAP API by modifying additional settings.

1.4. Download the WSDL from related communication arrangement which is configured in Step 1.3.2 in my previous blog-post on SAP C4C Integration with SAP CPQ as part of basic integration setup.

1.5. Save it on your local device as we’ll have to use it in CPI enhancement (step 3).

 

2. Configuration in SAP CPQ

2.1. Create a custom field ‘Winning Probability’ in SAP CPQ note its technical name.

3.Configuration in SAP CPI –

Configuration in SAP CPI is can be categorized into two scenarios as –

1. Enhancement in ‘Replicate Quote to SAP CPQ’

2. Enhancement in ‘Replicate Quote from SAP CPQ’

 

3.1. Enhancement in ‘Replicate Quote to SAP CPQ’

3.1.1. Edit the iflow ‘Replicate Quote to SAP CPQ’ and navigate to resources tab. Download the ‘QuoteCollectionEntityGET0’ xsd to your local system as highlighted in below screenshot.

3.1.2. Edit the file to add the relevant extension field. In our example, the custom field is on the header, so we’ll be adding the field in header.

3.1.3. Save the file without changing its extension and upload it in Resources section. In this case, we’re saving the file with new name as ‘QuoteCollectionEntityGET0_V0.1’.

3.1.4. Edit the message mapping by clicking on ‘MapC4CToCPQQuote’. Edit source message and replace existing xsd with the newly uploaded file in step 3.1.3

3.1.5. Now create a field under Header->CustomFields by clicking on ‘Select -> Duplicate Subtree’

3.1.6. Assign constant value to the newly created subtree. The constant value would be technical name of CPQ custom field. In our scenario it is ‘WinningProbability’ as highlighted in step 2.1. And map the custom fields data to value field.

3.1.7. Save and deploy the iflow. This will send the custom field data from C4C to CPQ during quote creation.

 

3.2. Enhancement in ‘Replicate Quote from SAP CPQ’.

3.2.1. Edit the iflow ‘Replicate Quote from SAP CPQ’

3.2.2. Upload the XML file downloaded in step 1.4 under Resources section – as highlighted in below screenshot,

3.2.3. Once the file is uploaded successfully, edit the quote mapping by clicking on tile ‘Map CPQQuote To C4CQuote’.

3.2.4. Edit the target message by clicking on ‘Edit Message’ button and replace the destination WSDL. Save the settings by clicking on OK

3.2.5. Now, we have the custom fields in both the messages and the only remaining part is to map them. Add below logic to transfer the custom field data from CPQ to C4C.

 

By following above approach, we can transfer the custom field data in one of the important integrations of SAP C/4 HANA Sales Cloud.Keep integrating!!! ?

 

Regards,

Nikhil

Assigned Tags

      14 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Deepak Singhal
      Deepak Singhal

      Nice!

      Author's profile photo Nikhil Walsetwar
      Nikhil Walsetwar
      Blog Post Author

      Thanks Deepak ??

      Author's profile photo Jamal Mohaideen K
      Jamal Mohaideen K

      Nice blog Nikhil?

      Author's profile photo Pravin Babu Tennukonda Athmarao
      Pravin Babu Tennukonda Athmarao

      Well explained, Thank You!

      Author's profile photo Saurabh Kabra
      Saurabh Kabra

      Very informative and nicely written with snapshots.

      Author's profile photo Ketan Patil
      Ketan Patil

      Nice Blog!! Thanks Nikhil

      Author's profile photo Parvez Soobhany
      Parvez Soobhany

      Hello Nikhil. Thanks for this nice blog.

      I need to send custom item fields from CPQ to C4C. How do I proceed ?

      Thanks for your advice.

       

      Regards,

      Parvez

      Author's profile photo Nikhil Walsetwar
      Nikhil Walsetwar
      Blog Post Author

      Hi Parvez,

      You have to follow the same steps which I have mentioned in the content. The only thing is you will only modify "Replicate quote from SAP CPQ" iflow.

      BR,

      Nikhil

      Author's profile photo Parvez Soobhany
      Parvez Soobhany

      Hello Nikhil,

      Thanks for your fast response.

      I can see the element ‘Custom Fields’ at header level of the WSDL but not in the item level, in the iFlow: Replicate Quote from SAP CPQ.

      Is there any way to replicate CPQ Item Custom Fields to C4C? 

      Thanks.

      Parvez

      Author's profile photo Nikhil Walsetwar
      Nikhil Walsetwar
      Blog Post Author

      Hi Parvez,

      what you can do here is just copy the header level custom field details and paste it in the items/item node when you edit the WSDL and that's it. the CPQ system will provide you the data in that format only.

      BR,

      Nikhil

      Author's profile photo Rony Varghese
      Rony Varghese

      Hi Nikhil,

      Could you please tell what logic is implemented in groovy script 'getCustomFieldValue' in the CPI mapping.

      Thanks,

      Rony

      Author's profile photo Nikhil Walsetwar
      Nikhil Walsetwar
      Blog Post Author

      Hi Rony,

      I’m using standard groovy script ‘getCustomFieldValue’ available in the iflow. Below is the related code.

      def void getCustomFieldValue(String[] var1,String[] var2, String[] var3, Output output, MappingContext context){
          /*
          <CustomField>
            <Content><![CDATA[AN CPQ Quote 180929 16:11]]></Content>
            <Id>6</Id>
            <Name><![CDATA[PO Number]]></Name>
          </CustomField>
          var2 is PO Number <Name>
          var3 is AN CPQ Quote 180929 16:11 <Content>
          */
          for (int i=0;i<var1.length;i++)
      	{ 
      		if (var1[i].equals(var2[0]))
      		{ 
      				output.addValue(var3[i]);
      				break;
      	}
      }
      }

      BR,

      Nikhil

      Author's profile photo Rony Varghese
      Rony Varghese

      Thank you! Nikhil.

      BR,

      Rony

       

       

      Author's profile photo Adrian Hideg
      Adrian Hideg

      Thank you Nikhil, your blog was very useful!

      One change for 3.1, that you also need to add the custom fields as Query Options here.