Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
DenizZilyas
Participant
1,249

Introduction :

In cloud integration, the processes of creating, deleting, or modifying a flow are done manually by entering the package. I will show how to perform these processes through the CPI link. The aim of this blog is to highlight the flexible structure of CPI.

Required:

  • SAP BTP and Integration Suite 
Cloud Integration Steps:

To demonstrate how all the processes work, I have covered them all in a single flow. This includes flow deletion, updating, creation, and the information we can retrieve related to the flow.

For a more straightforward architecture, I utilized process calls. Based on the type of request, process calls will be executed via the router.

The API we will use: https://{Account Short Name}-tmn.{SSL Host}.{region}.hana.ondemand.com/api/v1/IntegrationDesigntimeArtifacts

1- The overall view of the flow:

DenizZilyas_1-1718759428048.png

 

Local Process 1 : POST

DenizZilyas_3-1718756007145.png

 

Local Process 2 : PUT

DenizZilyas_4-1718756021553.png

Local Process 3: GET

DenizZilyas_6-1718756102227.png

Local Process 4: DELETE

DenizZilyas_7-1718756131666.png

The reason we separate with the router is that some processes require mapping, while others do not.

2-CM_Headers&Properties:

Our service works with a CSRF token, so we need to obtain the token first. In the initial content modifier, we store the request headers of the service.

Headers:

 

DenizZilyas_8-1718756835261.png

Properties:

We are storing parameters like Name, Id, PackageId, and Version in properties because we will use them in our services.

DenizZilyas_10-1718757189049.png

3-HTTP Fetch Token:

A defined user must access CPI as an authorized user. After defining security materials, credentials are provided in the flow.

 

DenizZilyas_9-1718756947238.png

4-CM_SetHeaders:

The service's response headers:

Content-type:application/atom+xml;type=entry;charset=utf-8

fetch-cookie :${header.set-cookie}

cookie : ${header.fetch-cookie.replace("[","").replace("]","").replace("; path=/; secure; HttpOnly","").replace("path=/, ","")}

I defined "fetch cookie" to avoid getting a forbidden error due to cookies in the service.

DenizZilyas_17-1718758080726.png

DenizZilyas_11-1718757291724.png

5-Router:

DenizZilyas_12-1718757320862.png

6- First Method : POST 

Since our goal is to create a flow using the POST method, here is the body we will send:

{
"Name": "string",
"Id": "string",
"PackageId": "Id of Package"
}

Message Mapping:

We stored the sent fields in properties in the content modifier. In the mapping, we will retrieve them from the properties.

DenizZilyas_13-1718757608676.png

OData V2- Connection and Processing:

DenizZilyas_16-1718757818495.png

DenizZilyas_14-1718757743031.png

Content Modifier :

DenizZilyas_1-1718758438890.png

 

 

DenizZilyas_0-1718758409610.png

Let's try it now in Postman.

DenizZilyas_0-1718759371068.png

 

Authorization:
CPI Technical User 
 
Body:
<Root>
    <Id>TestFlow</Id>
    <Name>TestFlow</Name>
    <PackageId>Testing</PackageId>
</Root>
 
DenizZilyas_2-1718759019341.png

GET METHOD:

We will obtain information about these artifacts by providing the Id and Version details from within the package.

/api/v1/IntegrationDesigntimeArtifacts(Id='${property.Id}',Version='${property.Version}')

DenizZilyas_2-1718759583926.png
 

Content Modifier:

DenizZilyas_5-1718759805781.png

Postman :

<Root>
    <Id>TestFlow</Id>
    <Version>1.0.0</Version>
</Root>
DenizZilyas_4-1718759781213.png

 PUT METHOD:

DenizZilyas_6-1718760515861.pngDenizZilyas_9-1718760693621.png

Postman:

Body:

<Root>
    <Name>ChangingNameTestFlow</Name>
    <Id>TestFlow</Id>
    <Version>1.0.0</Version>
</Root>
DenizZilyas_7-1718760588069.png

 

DenizZilyas_8-1718760649556.png

 DELETE METHOD:

/api/v1/IntegrationDesigntimeArtifacts(Id='${property.Id}',Version='${property.Version}')

DenizZilyas_10-1718760761577.png

Content Modifier:

 

DenizZilyas_12-1718760834785.png

Postman:

 Body:

<Root>
    <Id>TestFlow</Id>
    <Version>1.0.0</Version>
</Root>
DenizZilyas_15-1718761274105.png

 


DenizZilyas_14-1718760950140.png

Additional : A Groovy script exists within the subprocess to catch exceptions.I have embedded it into all local processes.Sometimes, error details don't propagate to the exception subprocess in the main flow, so you can embed them into local processes.

References: 

https://help.sap.com/docs/cloud-integration/sap-cloud-integration/integration-content?locale=en-US 

https://help.sap.com/docs/cloud-integration/sap-cloud-integration/handle-exceptions?locale=en-US&q=e... 

 

 

 

 

 

Labels in this area