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. As a best practice, the data is loaded in chunks of 1000 entries with 10 parallel processes.

The series is split in 3 parts. This blog post is the first part and explains how to model the iFlow only for header items. The second blog post 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.

Base iFlow for Header Items

The iFlow consists of 3 steps in a local integration flow for mass data upload with the OData service of a custom business object (CBO). Each step is explained in detail.

Step 1: Splitter to package mass data into chunks of 1000
Step 2: Map request chunks to OData Batch Processing
Step 3: Request Reply for OData Batch Processing Call

In this example the following payload is used as input message:

<Runs>
   <Run>
	<ContactID>100</ContactID>
	<IDOrigin>EXTERNAL</IDOrigin>
	<Field1>Max</Field1>
	<Field2>Mustermann</Field2>
   </Run>
   <Run>
	<ContactID>200</ContactID>
	<IDOrigin>EXTERNAL</IDOrigin>
	<Field1>John</Field1>
	<Field2>Doe</Field2>
   </Run>
   <Run>
	<ContactID>300</ContactID>
	<IDOrigin>EXTERNAL</IDOrigin>
	<Field1>Jane</Field1>
	<Field2>Doe</Field2>
   </Run>
   <Run>
	<ContactID>400</ContactID>
	<IDOrigin>EXTERNAL</IDOrigin>
	<Field1>Jane</Field1>
	<Field2>Doe</Field2>
   </Run>
</Runs>

As already mentioned, the Custom Business Object from the prerequisite blog post https://blogs.sap.com/2017/05/12/usage-of-odata-service-of-custom-business-object/ is used in this iFlow. The OData metadata document for the header node looks like this:

...
<EntityType Name="YY1_HCI_ID_ID_ORIGINType" sap:content-version="1">
 <Key>
  <PropertyRef Name="SAP_UUID"/>
 </Key>
 <Property Name="SAP_UUID" Type="Edm.Guid" Nullable="false"/>
 <Property Name="IDOrigin" Type="Edm.String" MaxLength="20"/>
 <Property Name="ContactID" Type="Edm.String" MaxLength="200"/>
 <Property Name="Field1" Type="Edm.String" MaxLength="20"/>
 <Property Name="Field2" Type="Edm.String" MaxLength="20"/>
 <NavigationProperty Name="to_Subnode" Relationship="YY1_HCI_ID_ID_ORIGIN_CDS.assoc_D8B3BE63CD921341D3685A1ADF2A8B57" FromRole="FromRole_assoc_D8B3BE63CD921341D3685A1ADF2A8B57" ToRole="ToRole_assoc_D8B3BE63CD921341D3685A1ADF2A8B57"/>
</EntityType>
<EntityContainer Name="YY1_HCI_ID_ID_ORIGIN_CDS_Entities" m:IsDefaultEntityContainer="true">
 <EntitySet Name="YY1_HCI_ID_ID_ORIGIN" EntityType="YY1_HCI_ID_ID_ORIGIN_CDS.YY1_HCI_ID_ID_ORIGINType"/>
 ...
 <FunctionImport Name="YY1_HCI_ID_ID_ORIGINSap_upsert" ReturnType="YY1_HCI_ID_ID_ORIGIN_CDS.YY1_HCI_ID_ID_ORIGINType" EntitySet="YY1_HCI_ID_ID_ORIGIN" m:HttpMethod="POST" sap:action-for="YY1_HCI_ID_ID_ORIGIN_CDS.YY1_HCI_ID_ID_ORIGINType">
   <Parameter Name="IDOrigin" Type="Edm.String" Mode="In" MaxLength="20"/>
   <Parameter Name="ContactID" Type="Edm.String" Mode="In" MaxLength="200"/>
   <Parameter Name="Field1" Type="Edm.String" Mode="In" MaxLength="20"/>
   <Parameter Name="Field2" Type="Edm.String" Mode="In" MaxLength="20"/>
 </FunctionImport>
</EntityContainer>
...

 

Step 1: Splitter to package mass data into chunks of 1000

To not overload the CBO backend system, the data is handled in chunks of 1000. A general splitter is used for that purpose, as this splitter type keeps the encapsulating element <Runs>. The incoming payload is split at XPath //Run:

Step 2: Map request chunks to OData Batch Processing

To setup the message mapping to the OData service call, you must add step 3 first. Step 3 will create the required target XSD. When you have the XSD, you can create a message mapping from your incoming split message to the OData service call. For the source message you need an XSD file that matches your incoming message. Add source and target XSD to your message and create the following mapping:

Disable the target tag <headers>. All entries are added to one changeset to allow a mass processing on SAP Marketing Cloud. Putting each entry to an own changeset would be processed like single record processing. The source tag <Runs> is mapped to the tag <batchParts>. The target tag <batchChangeSet> gets an empty constant assigned to create the tag. The tag <Run> is mapped to the tag <batchChangeSetPart>. The target tag <method> is mapped to a constant ‘POST’ as an upsert function is called with a POST method. The target tag <uri> is created out of several concatenations:

The payload now looks as follows:

<?xml version="1.0" encoding="UTF-8"?>
<batchParts>
  <batchChangeSet>
    <batchChangeSetPart>
	<method>POST</method>
	<uri>YY1_HCI_ID_ID_ORIGINSap_upsert?IDOrigin=’EXTERNAL’&ContactID=’100’&Field1=’Max’&Field2=’Mustermann’</uri>
    </batchChangeSetPart>
    <batchChangeSetPart>
	<method>POST</method>
	<uri>YY1_HCI_ID_ID_ORIGINSap_upsert?IDOrigin=’EXTERNAL’&ContactID=’200’&Field1=’John’&Field2=’Doe’</uri>
    </batchChangeSetPart>
    <batchChangeSetPart>
	<method>POST</method>
	<uri>YY1_HCI_ID_ID_ORIGINSap_upsert?IDOrigin=’EXTERNAL’&ContactID=’300’&Field1=’Jane’&Field2=’Doe’</uri>
    </batchChangeSetPart>
    <batchChangeSetPart>
	<method>POST</method>
	<uri>YY1_HCI_ID_ID_ORIGINSap_upsert?IDOrigin=’EXTERNAL’&ContactID=’400’&Field1=’Jane’&Field2=’Doe’</uri>
    </batchChangeSetPart>
  </batchChangeSet>
</batchParts>

 

Step 3: Request Reply for OData Batch Processing Call

To call a receiver in a local integration process, you need a request reply step.

Setting up the connection to the receiver will create an XSD which you need in step 2. You need to setup the connection as follows:

Select OData V2 as channel type and choose the select button on the processing tab. Select remote as connection source and connect to your SAP Marketing Cloud system. Choose Function Import as Operation and Function <CBO Name>Sap_upsert. Select Batch Processing.

Finish the Model Operation. You are informed that a new XSD File has been created. Go to the processing tab and select JSON as Content Type and set 5 minutes as timeout as this is the normal allowed runtime in SAP Marketing Cloud system.

Sara Sampaio

Sara Sampaio

Author Since: March 10, 2022

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x