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:
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!
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.
Open the ES Repository system that is the back end to your IS-U system.
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.
Choose Insert New Lines
Choose Insert New Subelement.
Enter a name, for example JointInvoicingCode.
Under Type, choose the input help icon and then select Data Type.
Choose a data type, for example, Code.
Choose the Change Lists tab.
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.
Log on to your IS-U system.
Use Transaction SPROXY.
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.
Using edit mode, choose regenerate.
Save and activate your changes.
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.
Using transaction SPRO, execute BAdI: IS-U Contract Data for Customer-Defined Logic, under SAP Utilities > Customer Service > Marketing-Integration > Business Add-Ins.
Create a new BAdI implementation for the ISU_MKT_CONTRACT_SOA BAdI definition.
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
CREATE PUBLIC .
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.
Log on to your SAP Cloud Platform tenant, and then open the Replicate Contract to Agreement and Agreement Terms integration flow.
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.
Edit the sender's message, by choosing the pencil icon.
In the next screen, choose the Replace Message icon for the Source Messages.
On the dialog box, choose Upload from File System and browse for the updated WSDL file that you had previously saved.
Choose Replace Message icon for the Target Messages.
Select the updated XSD file that you have previously generated from the OData service of SAP Marketing Cloud.
Choose OK to confirm.
Map the field from the source (IS-U WSDL) to the target (SAP Marketing Cloud) field.
Save your changes, and then re-deploy the integration flow.
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.