A key part of an SAP Cloud Integration project is to develop integration flows. An integration flow allows you to specify how SAP Cloud Integration is to process a message. SAP Cloud Integration provides a modeling environment that allows you to design the details of message processing (its senders and receivers as well as the individual processing steps) with a graphical user interface.
This section shows you step by step on how to develop and run integration flows which replicate incoming cost center fron SAP ECC to SAP Master Data Integration.
The Manage Security Material area provides an overview of security-related artifacts. Here, you will configure security for SAP Master Data Integration.
-
Login to CPI Tenant.
-
Expand the Navigation pane and switch to the Monitor > Integrations
-
In the Manage Security, choose Security Material.
-
Choose Create.
-
Choose OAuth2 Client Credentials.
-
In the Create OAuth2 Credentials wizard, enter below:
- In the Name field, enter MDICredential. This name will be used later in iflow.
- In the Description field, enter MDI Connection
- In the Token Service url field, enter url/oauth/token. You will find url from uaa.url in MDI Service Key.
- In the Client ID field, enter client id which will get from uaa.clientid in MDI Service Key.
- In the Client Secret field, enter client secret which you will find from uaa.clientsecret in MDI Service Key
- In the Client Authentication dropdown, chooe Send as Request Header.
- In the Content Type dropdown, chooe application/json.
- Choose Deploy.
An integration flow should be associated with an integration package. Here we will create a new package for integration flows.
-
Login to CPI Tenant.
-
Expand the Navigation pane and switch to the Design > Integrations
-
In the Design area, choose Create
-
In the new package:
- In the Name field, enter Cost Center Replication from ECC to SuccessFactors via MDI
- In the Short Description field, enter Cost Center Replication from ECC to SuccessFactors via MDI
-
In your package, switch to the Artifacts tab
-
From the Add menu, choose the entry Integration Flow to create a new integration flow
You use this procedure to create an integration flow for enabling communication between two heterogeneous applications or systems. The integration flow is a graphical model that consists of endpoints (systems, interfaces and channels) and flowsteps (activities that enable integration). When you create an integration flow, a corresponding integrated configuration is created in the Integration Directory.
Here you can either import our ready made iFlow and skip all the below steps of manual creation or else follow the manual iflow creation for your learning.
Download the Master.Data.Synchornization.Between.SAP.and.Legacy.System.using.SAP.Cloud.Integration.zip file from Releases and save into your local file.
-
In the Add Integration Flow dialog:
- Choose Upload
- In the Integration Flow field, choose Browse
- Choose Master.Data.Synchornization.Between.SAP.and.Legacy.System.using.SAP.Cloud.Integration.zip from local file.
- Choose OK
-
Choose Actions and then choose Configure
-
In the field MDIURI, enter MDI uri you get from service key.
-
Choose Deploy
-
Once the deployment is done, skip all the below steps and directy jump to section 14 Get the EndPoint of Deployed iflow .
Here you will create iflow from scratch which will help you in much more better understanding of implementation.
-
In the Add Integration Flow dialog:
- Choose Create
- In the Name field, enter iflow for cost center replication
- Choose OK
-
Choose your new integration flow iflow for cost center replicatio to enter the integration flow editor.
-
Within the integration flow editor, switch to the Edit mode by chossing button Edit on the top right
-
To have enough space for modeling the integration flow steps, we will rearrange and resize the components
- First, select the Receiver box and place it below the main process pool.
- Then, select the right edge of the Integration Process box and pull it further right to make the box wider.
- Finally, drag and drop the End Message event further right so that the whole integration flow stub looks like in the picture below.
-
In the properties of the Sender connection:
- In the Name field, Enter ECC
-
In the properties of the Receiver connection:
- In the Name field, Enter MDI
The IDoc adapter enables SAP Cloud Integration to exchange Intermediate Document (IDoc) messages with systems that support communication via SOAP Web services. Here we will integrate IDoc Adaptor which act an in incoming channel for cost center from SAP ECC.
-
If you choose the ECC component, the quick menu appears. From the quick menu, choose the Connector icon and drag it on the Start Message event
-
A dialog comes up where you need to choose the adapter type. In our case, choose the entry IDOC
-
In the properties of the IDOC connection, switch to tab Connection
- In the Address field, enter /ERP_to_EC_CostCenter_Replication_IDoc
-
Choose Save.
The Content Modifier allows you to modify a message by changing the content of the data containers that are involved in message processing (message header, message body, or message exchange). In this section, we will set cost center, key-mapping queries, incoming payload and modify the data accordingly.
-
If you select the Start Message event of the Integration Process pool, the quick menu appears. Choose the Plus icon of the quick menu.
-
In the upcoming menu, Choose the Content Modifier entry. Cloud Integration capability provides the AI-powered assistance to simplify and accelerate integration development, you will see that the Content Modifier listed as a recommended step here.
-
A Content Modifier step has been added to your integration flow model right after the Start Message event. Choose Content Modifier.
-
In the properties of the Content Modifier, switch to tab General.
- In the Name Field, Enter Content Modifier.
-
In the properties of the Content Modifier, switch to tab Message Header.
-
Choose Add.
-
Add below property:
Action Name Source Type Source Value Data Type Create logsys XPath /ns2:ODTF_CCTR01/ns2:IDOC/ns2:E101ODTF_S_COST_CENTER_REPL/ns2:BUS_DOC_BS_IDOC_LOG_SYS_ID java.lang.String Create cost XPath /ns2:ODTF_CCTR01/ns2:IDOC/ns2:E101ODTF_S_COST_CENTER_REPL/ns2:E101ODTF_S_COST_CENTER_DATA/ns2:REMOTE_EXTERNAL_OBJECT_ID java.lang.String
-
- In the properties of the Content Modifier, switch to tab Exchange Modifier.
-
Choose Add.
-
Add below property:
Action Name Source Type Source Value Data Type Create ecc Expression ${in.body} Create query Expression sourceContext=s4:${header.logsys}:sap.oitc.888&sourceKey=${header.cost}&targetContext=mdi:instanceId
-
-
In the properties of the Content Modifier, switch to tab Message Body.
- In the Type dropdown, choose Expression.
- In the Body field, enter below:
<MainRoot> ${property.ecc} <ID>${header.targetKey}</ID> </MainRoot>
-
Choose Save.
Certain integration scenarios might require that the Cloud Integration tenant communicates with an external service, retrieves data from it, and further processes the data. In such cases, you can use the request reply step as an exit to connect to the external service.
-
If you select the Content Modifier of the Integration Process pool, the quick menu appears. Select the Plus icon of the quick menu.
-
In the upcoming menu, Choose the Request Reply entry.
-
In the properties of the Request Reply, switch to tab General.
- In the Name Field, Enter Key - Mapping MDI.
-
Choose Save.
Use the HTTP receiver adapter to communicate with SAP Master Data Integration using HTTP message protocol.
-
If you select the Request Reply Key - Mapping MDI of the Integration Process pool, From the quick menu, choose the Connector icon and drag it on the Receiver MDI box.
-
A dialog comes up where you need to choose the adapter type. In our case, choose the entry HTTP
-
In the properties of the HTTP connection, switch to tab Connection
- In the Address field, enter URI/v0/odm/2.1.1/key-maps/sap.odm.finance.costobject.CostCenter
You will find the URI from MDI service key. sample URI can be https://one-mds.cfapps.sap.hana.ondemand.com
- In the Query field, enter ${property.query}
- In the Proxy Type dropdown, choose Internet
- In the Method dropdown, choose GET
- In the Authentication dropdown, choose OAuth2 Client Credentials
- In the Credential Name field, choose MDICredential
-
Choose Save.
-
If you select the Request Reply Key - Mapping MDI of the Integration Process pool, the quick menu appears. Select the Plus icon of the quick menu.
-
In the upcoming menu, Choose the Groovy Script entry.
-
In the properties of the Groovy Script, switch to tab General
- In the Name field, enter Set Header for MDI Instance ID.
-
If you select the Script Set Header for MDI Instance ID of the Integration Process pool, the quick menu appears. Select the Create icon of the quick menu.
-
You are now in the script editor.
-
Remove the existing code and Copy-paste the below code in the editor.
import com.sap.gateway.ip.core.customdev.util.Message; import groovy.json.* def Message processData(Message message) { def list = new JsonSlurper().parseText(message.getBody(String)); message.setHeader('targetKey',list.targetKey) return message; }
-
Choose OK.
-
-
Choose Save.
-
If you select the Set Header for MDI Instance ID Script in Integration Process pool, the quick menu appears. Choose the Plus icon of the quick menu.
-
In the upcoming menu, Choose the Content Modifier entry. Cloud Integration capability provides the AI-powered assistance to simplify and accelerate integration development, you will see that the Content Modifier listed as a recommended step here.
-
A Content Modifier step has been added to your integration flow model right after the Start Message event. Choose Content Modifier.
-
In the properties of the Content Modifier, switch to tab General.
- In the Name Field, Enter Content Modifier.
-
In the properties of the Content Modifier, switch to tab Exchange Modifier.
-
Choose Add.
-
Add below property:
Action Name Source Type Source Value Create targetKey Header targetKey
-
-
In the properties of the Content Modifier, switch to tab Message Body.
- In the Type dropdown, choose Expression.
- In the Body field, enter below:
${property.ecc}
-
Choose Save.
In the following, we need to map to the format that is required to trigger the Master Data Integration. For your convenience, we have provided a reusable message mapping artifact which maps the XML format of the SAP ECC IDoc to the JSON format of the SAP MDI.
-
First of all, we need to add the reusable message mapping to the resources of your integration flow. Download the message mapping CostMDIMap.zip and save into your local file.
-
In the properties of your integration flow, switch to the Resources tab
-
Below the Resources tab, switch to the References tab
-
From the Add References menu at the right, select the Message Mapping entry
-
Choose the message mapping Map CostMDIMap.zip from the local and and choose the Add button
-
As you can see from the figure below, the mapping has been added to the resources of your integration flow as reference
-
Let's now use the mapping in your integration flow model. If you select the Content Modifier step of the Integration Process pool, the quick menu appears. Select the Plus icon of the quick menu. Choose Message Mapping.
-
In the properties of the Message Mapping, switch to tab General.
- In the Name field, enter Mapping Cost Center Fields
-
In the properties of the Message Mapping, switch to tab Processing.
- In the Reference Type dropdown, choose Static.
- In the Resource, Choose Select and select Mapping CostMdiMap.mmap
- Choose OK.
-
Selected mapping will be reflected in Resource.
-
Choose Save.
-
If you select the Message Mapping Mapping Cost Center Fields of the Integration Process pool, the quick menu appears. Choose the Plus icon of the quick menu.
-
In the upcoming menu, Choose the Request Reply entry.
-
In the properties of the Request Reply, switch to tab General.
- In the Name Field, Enter Send Request to MDI.
-
Choose Save.
We will use SAP Master Data Integration (MDI) receiver adapter to synchronize your master data from SAP applications like SAP ECC and other third-party applications with SAP MDI service.
-
If you select the Request Reply Send Request to MDI of the Integration Process pool, From the quick menu, choose the Connector icon and drag it on the Receiver MDI box.
-
A dialog comes up where you need to choose the adapter type. In our case, choose the entry MDI
-
In the properties of the MDI connection, switch to tab Connection
- In the Address field, enter URI
You will find the URI from MDI service key. sample URI can be https://one-mds.cfapps.sap.hana.ondemand.com
- In the ODM Entity Type field, enter sap.odm.finance.costobject.CostCenter
- In the ODM Entity Version dropdown, choose 2.1.1
- In the API Type dropdown, choose Requests API
- In the Authentication dropdown, choose OAuth2 Client Credentials
- In the Credential Name field, choose MDICredential
-
In the properties of the MDI connection, switch to tab Processing
-
In the Operation field, enter ForcePatch
-
In the Change Token Prefix field, enter CPIMD
-
In the Retry Interval (in seconds) dropdown, choose 05
-
In the Retry Iterations dropdown, choose 01
-
Tick the Change Request Contains LocalIds checkbox.
-
In the LocalId Configuration, enter below value:
Application Tenant Type Additional Context LocalId Status LocalId Source s4 S4ACLNT000 sap.odm.finance.costobject.CostCenter sap.oitc.888 ${header.cost} active Property
-
- Choose Save.
-
From the quick menu, choose the Process icon and then choose Exception Subprocess
-
Drag it on the Editor.
-
Choose Save.
-
Your final layour look below:
-
Within the integration flow editor , Choose Deploy.
-
You will get a popup for confirmation. Choose Yes.
-
You will get a confirmation message that deployment is success.
Onc your iflow is deployed, you will get a deployed URL, which we be later using while configuring backend.