CRM and CX Blogs by SAP
Stay up-to-date on the latest developments and product news about intelligent customer experience and CRM technologies through blog posts from SAP experts.
cancel
Showing results for 
Search instead for 
Did you mean: 
eileenriediger
Explorer
This series of blog posts will explain how you can model your integration Flow (iFlow) to create and update data in your Custom Business Object (CBO). As a prerequisite you should read blog post https://blogs.sap.com/2017/05/12/usage-of-odata-service-of-custom-business-object/. The Custom Business Object YY1_HCI_ID_ID_ORIGIN from that blog post is used in the following integration flows.

The series is split in 3 parts. The first part explains how to model the iFlow only for header items. This blog post is the second part and explains how to extent the base iFlow for header items to include subnode items. The third blog post explains how to model the creation and update of subnode items. All explanations contain create and update use cases only.

The integration package, which you can download at https://customer-office-files.demo.hybris.com/medias/SCN/Custom_Business_Object_Integration_Flows.zi...
contain integration flows for deletion use cases in addition.

Extended iFlow for Header Items with Subnode Items


If your CBO has subnodes you need to enhance the iFlow. An additional local integration process is needed that handles the Header and Subnode Items separately and the response from the upsert of header items must be considered, as this response contains the SAP_UUID of each header item:


Step 1: Sequential Multicast with Gather
Step 2: Map request chunks to OData Batch Processing
Step 3: Request Reply for OData Batch Processing Call
Step 4: Gather all Upserted Header Items
Step 5: Delete Multimessage Part

Step 1: Sequential Multicast with Gather


First a sequential multicast must be introduced in the new local integration process. The sequential multicast takes care that first the header items are upserted and afterwards the subnode items are considered. It cannot be a parallel multicast, as the SAP_UUID of the header items is needed to create and update subnode items.


To join the received header SAP_UUID and match them to the subnode items, a join and gather step are needed after the sequential multicast. The join needs no configuration. The gather step is configured with XML (Same Format) as Incoming Format and Combine as Aggregation Algorithm.

Step 2: Filter Response


As the response from the OData Call is quite big, and you are only interested in the entity part of the header node, the response is filtered down to //YY1_HCI_ID_ID_ORIGIN.

Step 3: Content Modifier to Add Root Tag


As the filter step offers a node list a root tag is needed for further processing. Therefore, with a content modifier the root tag <Temporary> is added.

Step 4: Gather all Upserted Header Items


In this step the responses of the split OData calls are gathered back. As incoming format XML (Same Format) is used and Combine as Aggregation Algorithm.


The payload now looks as follows:
<?xml version='1.0' encoding='UTF-8'?>
<multimap:Messages xmlns:multimap="http://sap.com/xi/XI/SplitAndMerge">
<multimap:Message1>
<Temporary>
<YY1_HCI_ID_ID_ORIGIN>
<YY1_HCI_ID_ID_ORIGINType>
<Field2>Mustermann</Field2>
<SAP_UUID>fa163e0b-249b-1ee9-a5e4-2e3fe2d104e7</SAP_UUID>
<IDOrigin>EXTERNAL</IDOrigin>
<ContactID>100</ContactID>
<Field1>Max</Field1>
</YY1_HCI_ID_ID_ORIGINType>
</YY1_HCI_ID_ID_ORIGIN>
<YY1_HCI_ID_ID_ORIGIN>
<YY1_HCI_ID_ID_ORIGINType>
<Field2>Doe</Field2>
<SAP_UUID>fa163e0b-249b-1ee9-a5e4-2e3fe2d124e7</SAP_UUID>
<IDOrigin>EXTERNAL</IDOrigin>
<ContactID>200</ContactID>
<Field1>John</Field1>
</YY1_HCI_ID_ID_ORIGINType>
</YY1_HCI_ID_ID_ORIGIN>
<YY1_HCI_ID_ID_ORIGIN>
<YY1_HCI_ID_ID_ORIGINType>
<Field2>Doe</Field2>
<SAP_UUID>fa163e0b-249b-1ed9-a7c9-9d0c56849f21</SAP_UUID>
<IDOrigin>EXTERNAL</IDOrigin>
<ContactID>300</ContactID>
<Field1>Jane</Field1>
</YY1_HCI_ID_ID_ORIGINType>
</YY1_HCI_ID_ID_ORIGIN>
<YY1_HCI_ID_ID_ORIGIN>
<YY1_HCI_ID_ID_ORIGINType>
<Field2>Doe</Field2>
<SAP_UUID>fa163e0b-249b-1ed9-a7c9-9d0c5684bf21</SAP_UUID>
<IDOrigin>EXTERNAL</IDOrigin>
<ContactID>400</ContactID>
<Field1>Jane</Field1>
</YY1_HCI_ID_ID_ORIGINType>
</YY1_HCI_ID_ID_ORIGIN>
</Temporary>
</multimap:Message1>
</multimap:Messages>

 

Step 5: Delete Multimessage Part


In the last step the payload is changed for further processing. A groovy script is used to delete the tags <Temporary>, <multimap:Message1> and <multimap:Messages>. Moreover, a root tag <HeaderItems> is added.
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
def Message processData(Message message) {
//Body
def body = message.getBody(java.lang.String) as String;
body = body.replaceAll("<multimap:Messages xmlns:multimap=", "<HeaderItems>");
body = body.replaceAll("\"http://sap.com/xi/XI/SplitAndMerge\">", "");
body = body.replaceAll("<multimap:Message1>","");
body = body.replaceAll("<Temporary>","");
body = body.replaceAll("</Temporary>","");
body = body.replaceAll("</multimap:Message1>", "");
body = body.replaceAll("</multimap:Messages>", "</HeaderItems>");
body = body.replaceAll("<?xml version='1.0' encoding='UTF-8'?>", "");
message.setBody(body);
return message;
}

 

To setup the iFlow for the subnode items, continue with blog post part 3.