Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
ravijangra2014
Explorer

This blog is to share the knowledge of Integration via SAP BTP CPI. During my learning phase of CPI, I've gone through an uncountable number of articles to better understand CPI and its various features which is a bit irritating when you have to search online and struggle a lot just to get any particular information.


Thereby, I've written below content which includes every step starting from scratch i.e. Registering on BTP, to designing your own custom iflow for a customer requirement whereas numerous links to very helpful articles and videos have been put so that all the information can be referred from here only.



Below is the list of content:




  1. Create a Trial BTP account and initial Setup



  1. Check the authorization of a CPI user



  1. CPI Overview (includes Discover, Design, Monitor and Settings)



  1. Designing in CPI



  1. Exception Handling in CPI



  1. Monitoring in CPI



  1. Exposing CPI Endpoints to call externally



  1. Creating a Service Key in BTP


————————————————————————————————————————————–




  1. Create a Trial BTP account and initial Setup


Follow below SAP blog to create your Trial BTP account and Initial setup for Cloud Platform Integration.


Creating Trial account for Cloud Platform Integration on Cloud Foundry Environment, Creating User Cr...


OR


Trial Account Setup for SAP Integration Suite (CPI, Integration Advisor, API Management, Enterprise ...





  1. Check the authorization of a CPI user


Make sure to provide all the roles to authorize your user in BTP under the Security section.



 

  1. CPI Overview (includes Discover, Design, Monitor and Settings)



CPI Overview - Discover




CPI Discover section provides a number of standard Integration designs inside standard packages shown prebuilt by SAP where no further development is required. You can directly import it into your package and configure it as per the client system details. However, two types of artifacts i.e. Configurable (can't edit, only change the sender/receiver endpoints) and Modifiable (can make any sort of changes).



CPI Overview - Design




CPI Design section provides the complete platform to develop your custom Integration flows (iflows) inside the package shown. Packages as well as iflows can be directly imported here which are downloaded from other CPI tenants.



CPI Overview - Monitor




CPI Monitor section provides all the features to monitor the deployed iflows (standard and custom), debug in case of errors, manage credentials as well as certificates, runtime variables, etc.



CPI Overview - Settings




CPI Settings section provides tenant settings that aren't required in daily-based integration development.





  1. Designing in CPI



In the design section, initially, you have a create a new package in which all the artifacts/iflows will be created further.




You can create multiple packages to categorize various types of iflows as per the need. Also, there is an option to import any package which could be exported from other tenants.


Inside the package, various features like Edit this package, export and delete are available.




Overview shows the basic details of this package.


Artifacts contain the actual integration objects.


Documents contain any type of documents regarding this package.


Tags show the tags assigned to this package regarding the integration solution.



In Artifacts, you can create Integration Flow (iflow), Message Mapping, Value Mapping, Script Collection, Integration Adapter.




Integration Flow is created to design end-to-end integration between two or more systems where data format conversion, data manipulation, data filtering, conditionally routing, message mapping, value mapping, encoding/decoding, encryption/decryption, etc. features can be used. This is the main topic so it is explained below in detail.



Message Mapping is created to map two different structures(source and target) to transform the message as shown below. Message mapping is done in XML format only. This can be used in iflows.




Refer following for a detailed understanding of Message Mapping:


SAP Cloud Integration – Message Mapping as Artifact



Value Mapping is created to map Key-Value pair where a different set of keys are supposed to be converted to specific values during message processing as shown below. This can be used in iflows.




Refer following for a detailed understanding of Value Mapping:


Message Mapping and Value Mapping in SAP CPI


SAP Cloud Platform Integration (CPI) || Part 12 || Value Mapping



Script Collection is created to store a collection of multiple Groovy and Java Scripts which can further be used in iflows.




Refer following for a detailed understanding of Script Collection:


Using Script Collection across various Integration Flows in a Package in SAP CPI


Script collection reusable artifact in SAP Cloud Integration



Integration Adapter is to add new custom adapters that you've developed using adapter SDK. This can be used in iflows.




Refer following for a detailed understanding of Integration Adapter:


Importing Custom Integration Adapter in the Cloud Foundry Environment


Integration Suite – Developing Custom Adapters with IDE of Your Choice



To create a custom Integration flow(iflow) -> Edit the package -> click on Add button -> select Integration Flow.


Further provide the required details and click ok to create iflow.



On other hand, an iflow can also be uploaded directly from your computer if you have downloaded it earlier.



Once iflow is created, there are various actions you can take:




Delete is to delete this iflow.


Copy is to create one copy of this iflow with a different name in this same package.


View Metadata is to see and edit iflow metadata i.e. iflow name, description, etc.


Download is to download the iflow in your computer, which can later be imported on any CPI tenant.


Configure is to configure the iflow parameters which you have set during the iflow design. This doesn't need to edit the iflow.


Deploy is to deploy the iflow on CPI tenant on runtime. To run any artifact, it needs to be deployed.


Version is also one important concept to understand that while development you can save your work done in versions which can further be helpful if you want to revert to any previous version (or newer versions).



By clicking on the artifact name, it will open the development workspace:




On the top left corner, there are navigation options to Discover, Design, Monitor and Settings. Click on the package name in the top left corner if you want to go back to the package.


On the top right corner, Edit is to edit the iflow to make changes in iflow (Note: You might not see this edit option in standard iflows if they are not modifiable).



Configure is to configure the iflow parameters which you have set during the iflow design. This doesn't need to edit the iflow.


Deploy is to deploy the iflow on CPI tenant on runtime. To run any artifact, it needs to be deployed.


Delete is to delete this iflow (Warning: You might not able to recover the artifact once deleted, so make sure you've downloaded this for the safe side before deleting).



On the right side, there are scaling options to handle the zooming workspace.


On the bottom right corner as well as the bottom bar in light blue color, there are features where you can choose a different option and do the configuration of selected palettes in iflow workspace.


Below bar contains all the palettes (different components used to design any iflow). To use any palette, click on any icon shown, which opens a dropdown as shown (opened dropdown is for mappings) then choose the required palette by clicking on it once and clicking again in the workspace to drop it.




Whenever you create any new iflow, it comes with the below Integration Process and a few palettes. Integration Process is the main palette (the main component of this workspace) in which usually, integration is designed with the help of other palettes by putting in Integration Process (e.g. Start, one arrow and End). Processing of the iflow also starts with Integration Process.




To take any action on any palette, select the palette by clicking on it. A few direct actions (in the above screenshot i.e. paste, delete; these can vary according to the palette) are already shown on the right side of the selected palette and more functionalities are at the bottom.



Below are some most commonly used palettes/iflow steps:


Participant:




Receiver is used to connect to any external system as a receiver.


Sender is used to connect to any external system as a sender.



Event:




Refer following for a detailed understanding of different event iflow steps:


Blog 7: Message Events in Integration Flows


Define Events



However, a timer is chosen from the Events in this case and put in the Integration Process:



Note: Every palette in iflow has a General tab where you can rename the name of the palette at your convenience.



Timer is used to provide iflow a trigger point, from where message processing of iflow will start. It can be scheduled as per the requirement in Scheduler tab shown below. Now, scheduled as Run Once means iflow will be processed/run only once after deploying.




Transformation:




Refer following for a detailed understanding of message transformation and routers steps:


Message transformations and Routing features: HCI vs PI/PO



Content Modifier is chosen as it is used to manipulate the incoming message (Headers, Exchange Properties, Body).






In the content modifier, a constant body is put just for the demo purpose.



Refer following for a detailed understanding of Content Modifier:


Define Content Modifier


SAP Cloud Platform Integration (CPI) || Part 5 || Content Modifier



It is very important to connect your iflow steps/palettes using an arrow to complete the integration as below.




When you select any palette it shows one arrow in the right-side options. To connect it to another palette -> click on this arrow and drag it to your target palette. It basically shows the direction of your message processing as below:



Note: Generally, four types of parameters flow through this arrow from one palette to another i.e. Message Headers, Exchange Properties, Message Body and Runtime parameters( Message processing id, status, start/end runtime, etc.)



Filter is used to filter out the XML payload based on conditions provided in Xpath.



Refer following for a detailed understanding of the Filter:


[SAP Cloud Platform-Integration] Content Filter in Detail


Variant: Content Filter Step



Converter is used to convert one format of data to another.



Refer following for a detailed understanding of Converter:


Configure CSV to XML Converter


Enterprise Integration with SAP CPI (Part 4 of 4)



Routing:




Router is used to decide which path your message has to flow. A router can connect through one incoming and multiple outgoing routes but then it decides only one outgoing route based on conditions provided in outgoing routes (conditions can be written using XPATH or Camel expressions). There has to be at least one outgoing route with a Default Route condition, this route is processed only if no other route condition is satisfied.



Refer following for a detailed understanding of the Router:


Define Router


explain Conditional router in detail in CPI


EIPinCPI – Message Router



Multicast is used to send a single incoming message to multiple outgoing routes. Message can multicast into multiple routes in two ways: Parallel and Sequential Multiple.




Parallel Multicast will send messages parallelly to all outgoing routes at the same time.


Sequential Multicast will send messages in a sequence to all the outgoing routes based on the sequence you have configured.



Refer following for a detailed understanding of Multicast:


Define Multicast


Blog 3: Multicast Pattern in Integration Flows (SAP Cloud Platform Integration)


Behavior of CPI’s message header/property in a multicast



Gather and Join are used to merge multiple routes coming from multicast into a single outgoing route.



Refer following for a detailed understanding of Gather and Join:


Define Gather and Join


Enrich/Combine the message using join and gather in CPI



Aggregator is used to combine multiple incoming messages from one route incoming route into one outgoing route with conditions to be configured.



Refer following for a detailed understanding of Aggregator:


EIPinCPI – Aggregator


Blog 8: Message Aggregation Pattern in Integration Flows


Aggregator in SAP CPI : Tutorial



Call:




Here, in External Call you can connect to any external system using various adapters e.g. HTTP, SOAP, OData, JDBC, etc. In the Local call, a call from the Integration process to the local Integration process be initiated.



External Call:




Request Reply is the most call palette used to make service calls with a response expected, in which various Adapters are available, which can be configured to connect to the external system.



Refer following for a detailed understanding of Request-Reply:


SAP Cloud Platform Integration (CPI) || Part 8 || Working with Request Reply


Request-Reply in SAP CPI



Send is used to configure a service call without any response expected.



Refer following for a detailed understanding of Send:


SAP Cloud Platform Integration (CPI) || Part 10 || How to use “Send”?



Local Call is used to call a local integration process from another integration process in the same iflow.



Refer following for a detailed understanding of Local Call:


SAP Cloud Platform Integration (CPI) || Part 11 || How to use a Local Integration Process



Persistence:




These features are used to store some sort of information on CPI Tenant at runtime of iflow, which also can be retrieved later.



Refer following for a detailed understanding of Persistence:


SAP CPI : Retrieve persisted messages through iFlow by consuming API(Neo)



Data Store Operations:




In Data Store Operations, there are four operations available as of now i.e. Write is to store the message onto CPI tenant permanently, Delete is to delete the stored message, Get is to retrieve the stored message and Select is to select a message from the data stored already and send in the message body of iflow.



Refer following for a detailed understanding of all Data Store Operations:


Define Data Store Operations



Refer following for a detailed understanding of Data Store Operations:


Data Store Operations in SAP CPI – Step by Step Guide



Persist is to store the message in the CPI data center which is not the part of message monitor and can be retrieved using the Message ID persisted in DB.



Refer following for a detailed understanding of Persist:


Persist Messages


Retrieve Persisted payload in SAP CPI



Write Variable is used to define a variable and share its value across different iflows in the CPI tenant.



Refer following for a detailed understanding of Write Variable:


Define Write Variables


Example Scenario: Sharing a Variable Across Two Integration Flows


SAP CI – Data Persistence: Variables and Number Ranges



Mapping:




Refer following for a detailed understanding of different types of Mapping:


SAP CPI Message Mapping Examples (Groovy, XSLT, Graphical)



Message Mapping: Mapping Overview in SAP Cloud Platform Integration (f.k.a. HCI or SAP HANA Cloud Platform,integratio...



Operation Mapping: [ How-To ] Moving Operation Mapping from SAP Process Orchestration To SAP Integration Suite



Script is used to write your own code to fulfill the requirement which cannot be done using cpi palettes. CPI provides options for using JavaScript and Groovy Script.




Refer following for a detailed understanding of Groovy Script:


SAP Cloud Integration (CPI/HCI) || Writing Groovy Scripts _ With Basic Examples


CPI Groovy Examples



Refer following for Groovy Compiler made perfectly to develop groovy code as per the CPI message processing way.


https://groovyide.com/cpi





  1. Exception Handling in CPI



In CPI, there is a standard way to handle runtime errors. Wherever any failure occurs during runtime in an iflow it will directly trigger the Exception Subprocess and continue to process the steps in it. As per the usual practice, the error is printed as an attachment in the monitor and an email alert is triggered to report the error to the concerned team as below.




Refer following for a detailed understanding of Exception Handling in CPI:


How to create Exception Sub Process for i-Flow in SAP CPI



YouTube Demo:


SAP CPI Exception sub process || Error Handling || Step by step guide


Exception handling in SAP CPI





  1. Monitoring in CPI




In the monitor section, you can monitor and analyze several aspects of artifacts.


Monitor Message Processing is to check the individual messages being executed.


Manage Integration Content is to check the artifacts deployed on the tenant.


Manage Security is to maintain various security materials e.g. credentials, certificates, etc.


Manage Stores is to check and maintain storage material e.g. variables, message persisted number ranges, etc.



Refer following for detailed understanding about Monitor in CPI:


Monitoring in SAP CPI, Cloud Platform Integration


How to monitor SAP CPI in 2022





  1. Exposing CPI Endpoints to call externally



An iflow can be triggered either from any external system or internally in CPI e.g. Start Timer. If you want to trigger it externally, a Sender system and a sender Adapter are required to generate the CPI Iflow Endpoint as shown below. Consuming these Endpoints you can initiate the call to run iflow using Postman or any third-party system.




Refer following for a detailed understanding of How to call CPI Iflow externally:


How to trigger SAP Cloud Platform Integration via Oauth in Postman


Sender-Initiated Scenario (with HTTPS Sender Adapter)


[SAP CPI] – HOW TO EXPOSE INTEGRATION FLOW ENDPOINT AS A API



YouTube Demo:


SAP CPI Course | Request Reply - HTTP/OData | Get Northwind Customers using HTTP Adapter





  1. Creating a Service Key in BTP


 

In the above step Exposing CPI Endpoints to call externally, iflow endpoint will be generated in CPI Monitor. However, to authenticate the endpoint from an external system you need a Service Key which will be created in the SAP BTP subaccount associated with your CPI. In Service Key, Client ID and Client Secret can be used as the Username and password of Basic Authentication.



Refer following for a detailed understanding of Generating a Service Key in BTP:


Creating an API Instance


Using Cloud Integration APIs with Tools on Cloud Foundry: Creating a Service Key



    Conclusion


After reading the above blog, you should have a good knowledge of End-to-End Integration via SAP BTP CPI starting from scratch. Considering that you've gone through all the links referred to the blog, you're ready to start designing your artifacts based on requirements.



I'd like to thank everyone whose knowledgeable articles have been referred to the blog.


Please follow the profile ravijangra2014 to keep receiving updates about my new upcoming blogs and share your helpful feedback in the comments below.



My other SAP blog is on Fetching picklists from SuccessFactors and implementing custom lookup using Groovy Script in CPI. In this blog, you will see how a SuccessFactors picklist lookup can be implemented and consumed the picklist <key - value> pairs in the incoming XML and further message processing using SAP cloud platform integration in detail.


4 Comments
Labels in this area