Skip to Content
Technical Articles

How Utilities Can Enrich Their SAP S/4HANA Integration with SAP Marketing Cloud by Using Custom Fields

You’ve read why you should integrate SAP S/4HANA Utilities with SAP Marketing Cloud. Perhaps you’ve also read how utilities can leverage the Segmentation application to identify target groups and have gained powerful insight to your data.  Now, you may be wondering how you can further enrich your integration with the SAP Marketing Cloud solution to replicate data beyond the standard solution.  This blog post will guide you on how you can replicate any data element from IS-U to SAP Marketing Cloud by using custom fields.

Prerequisite: You’ve integrated SAP S/4HANA with SAP Marketing Cloud.  If you haven’t, check out the integration guide in the SAP S/4HANA Utilities Integration with SAP Marketing Cloud integration package.

Before we get started, let’s recall the flow of data.

We can see that, firstly, the data to be replicated is collected from SAP S/4HANA Utilities and sent to the SAP Cloud Platform Integration service.  After some mapping, the data is then sent to SAP Marketing Cloud.  Our approach of enriching the data replication will start with SAP S/4HANA, then we will apply the necessary changes to SAP Marketing Cloud, and lastly we will update our integration flows on SAP Cloud Platform Integration to map the new data elements between SAP S/4HANA Utilities and SAP Marketing Cloud.

For this blog post, we will use the example of adding joint invoicing information to the utilities contract replication service.  The necessary tasks are:

IS-U

  • Adding the new field to the service interface for utilities contract replication in Enterprise Service Repository (ES Repository).
  • Regenerating the service consumer in SAP S/4HANA Utilities.
  • Implementing a BAdI to populate the new field.

SAP Marketing Cloud

  • Creating and publishing a new custom field to store the joint invoicing information.
  • Enabling the custom field in the Segmentation application (optional).

SAP Cloud Platform Integration

  • Uploading from IS-U a new WSDL that includes the new field in the payload.
  • Refreshing the EDMX file from SAP Marketing Cloud to get access to the new custom field.
  • Configuring the mapping of the new field.

Let’s get started!

IS-U

Adding the new field to the utilities contract replication service interface for utilities contract replication in ES Repository.

Following the below procedures we will add fields to the Contract Replication Service Interface in SAP Enterprise Service Repository.  The payload used by the replication service is defined in SAP ES Repository.

Procedure:

  1. Open the ES Repository system that is the back end to your IS-U system.
  2. Navigate to the UtilitiesContractBulkReplicateRequest_Out service interface under IS-UT > IS-UT 803 > http://sap.com/xi/IS-U/Marketing/Global2.
  3. Navigate to the Message Type under Messages segment and open the relevant Data Type.

    Note: For the example of joint invoicing, select the UtilitiesContract data type in the UtilitiesContractBulkReplicateRequest Message Type.

  4. Choose Edit.
  5. Choose Insert New Lines 
  6. Choose Insert New Subelement.
  7. Enter a name, for example JointInvoicingCode.
  8. Under Type, choose the input help icon and then select Data Type.
  9. Choose a data type, for example, Code.
  10. Choose Save.
  11. Choose the Change Lists tab.
  12. Choose the change and then activate.

Regenerating the Service Consumer (Proxy)

After the new field has been added to ES Repository and then activated, the consumer proxy in the IS-U system must be regenerated.

Procedure:

  1. Log on to your IS-U system.
  2. Use Transaction SPROXY.
  3. Find the relevant service consumer to regenerate.
    To find the service consumer for utilities contract replication, you can use the following search parameters:
    a. Choose the Open Object icon.
    b. Under Proxy Object, choose the Use External Key radio button.
    c. Under Type, choose Service Consumer.
    d. Enter the name UtilitiesContractBulkReplicateRequest_Out.
    e. Enter the namespace http://sap.com/xi/IS-U/Marketing/Global2.
  4. Using edit mode, choose regenerate.
  5. Save and activate your changes.
  6. In the WSDL tab, save a local copy of the WSDL file for later usage.

 

Implementing a BAdI to Populate the New Fields of the Replication Request Payload

The contract replication service has a BAdI definition called ISU_MKT_CONTRACT_SOA. In order to populate the new field, we’ll need to create a new implementation for that BAdI.

Procedure:

  1. Using transaction SPRO, execute BAdI: IS-U Contract Data for Customer-Defined Logic, under SAP Utilities > Customer Service > Marketing-Integration > Business Add-Ins.
  2. Create a new BAdI implementation for the ISU_MKT_CONTRACT_SOA BAdI definition.
  3. The class needs to implement the IF_ISU_MKT_CONTRACT_SOA_BADI~OUTBOUND_PROCESSING method. This method’s signature contains two parameters:
    – IN (importing): Contains the information of the contract to be replicated.
    – OUT (changing): Contains the payload of the replication request.  The structure will contain the new fields that we’ve created. We’ll be able to populate those fields in the BAdI implementation.

Here’s an example implementation that populates the new field:

CLASS zcl_test_contract_badi DEFINITION 
   PUBLIC 
   FINAL 
   CREATE PUBLIC . 

  PUBLIC SECTION. 
  
    INTERFACES if_badi_interface . 
     INTERFACES if_isu_mkt_contract_soa_badi . 
   PROTECTED SECTION. 
   PRIVATE SECTION. 
 ENDCLASS. 
 
CLASS zcl_test_contract_badi IMPLEMENTATION. 
 
* <SIGNATURE>----------------------------------------------------------------------------------------+ 
 * | Instance Public Method ZCL_TEST_CONTRACT_BADI->IF_ISU_MKT_CONTRACT_SOA_BADI~OUTBOUND_PROCESSING 
 * +-------------------------------------------------------------------------------------------------+ 
 * | [--->] IN                             TYPE        ISUS_CONTRACT_INTERNAL 
 * | [<-->] OUT                            TYPE        ISU_MKT_UTILITIES_CONTRACT_REP 
 * | [!CX!] CX_BS_SOA_BADI_PROCESSING 
 * +--------------------------------------------------------------------------------------</SIGNATURE> 
   METHOD if_isu_mkt_contract_soa_badi~outbound_processing. 
  
    DATA: 
       lv_gemfakt TYPE e_gemfakt. "Joint invoicing information 
  
    SELECT SINGLE gemfakt 
       FROM ever 
       WHERE vertrag = @in-vertrag 
       INTO @lv_gemfakt. 
  
    out-utilities_contract-jointinvoicingcode = lv_gemfakt. 
  
  ENDMETHOD. 
 ENDCLASS. 

 

4. Activate the BAdI implementation.

5. The replication payload will now include the information regarding joint invoicing.

 

SAP Marketing Cloud

Adding Custom Fields to Business Object in SAP Marketing Cloud

Follow the How to Create Custom Fields instructions from the SAP Marketing Cloud documentation to create the new field for storing the joint invoicing information on the agreement entity.

Enabling the custom field in Segmentation Application (Optional)

To make the new custom fields available in the Segmentation application, follow the Custom Fields in Segmentation instructions from the SAP Marketing Cloud documentation.

SAP Cloud Platform Integration

Configuring the Data Mapping in the Integration Flows in SAP Cloud Platform Integration

In order to configure the integration flows to accommodate the new fields, we’ll need the updated WSDL file previously obtained.

We’ll also need to acquire the updated $metadata XSD file from the relevant OData service of SAP Marketing Cloud. This guide describes how we can obtain that file.

Here’s how we can update both the WSDL file and the XSD file in the message mapping segment of our integration flow.

Procedure:

  1. Log on to your SAP Cloud Platform tenant, and then open the Replicate Contract to Agreement and Agreement Terms integration flow.
  2. Using edit mode, open either Map Contracts to Agreements or the Map Contracts to Agreement Terms message mapping step, depending on the object to which you decided to add the new custom field of SAP Marketing Cloud.
  3. Edit the sender’s message, by choosing the pencil icon.
  4. In the next screen, choose the Replace Message icon for the Source Messages.
  5. On the dialog box, choose Upload from File System and browse for the updated WSDL file that you had previously saved.
  6. Choose Replace Message icon for the Target Messages.
  7. Select the updated XSD file that you have previously generated from the OData service of SAP Marketing Cloud.
  8. Choose OK to confirm.
  9. Map the field from the source (IS-U WSDL) to the target (SAP Marketing Cloud) field.
  10. Save your changes, and then re-deploy the integration flow.

 

Results

After completing all the procedures explained above, the contract replication service should now be replicating information about the joint invoicing of the contracts. You should also be able to create segments based on the new field in the Segmentation application.

If you encounter any issues, please create a support ticket for the component IS-U-CS-MA.

1 Comment
You must be Logged on to comment or reply to a post.