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: 
avinash_3
Explorer
Introduction:

In this blog, we will be using SAP Cloud Platform Integration(CPI) to post some data to OData from Postman as a Sender.

CPI is a robust integration platform that connects various applications and services, enabling seamless data exchange across an enterprise.

Prerequisites:


Before we enter into the integration flow, make sure you have the following prerequisites in place:

  1. SAP BTP Account (Trial or Enterprise)

  2. SAP Cloud Platform Integration (CPI)

  3. Basic Knowledge in CPI


Note: Make sure to provide all the roles to authorize your user in BTP under the Role section for Integration Suite Access.

Scenario:


The aim of the iFlow is to post some data in SAP using OData as a receiver adapter and HTTPS as a Sender adapter. Here we are going to call the API from POSTMAN as a Sender.

Since we all might know about Northwind OData service available as open source so we are going to consuming the same OData service to post PRODUCTS(Entity) data.

Solution:


In the Integration Flow, we are using

  1. HTTPS as a Sender Adapter

  2. Content Modifier to Modify the JSON Data

  3. JSON to XML Converter ( To parse as XML Payload )

  4. Request Reply to connect Receiver End Point.

  5. Receiver as an OData Adapter


Below is my iFlow Design:

 


 

Before testing the iFlow, first we will test the Northwind OData service from POSTMAN.


Get Products Data using Postman


Status : 200 ok and we get the results of Products Entity.

Now, let's check the count of the same entityset.


Get Products Count - Postman


Status : 200 ok and we get the count of Products Entity which is 13 now.

 

Let's see the iFlow parts:

HTTPS Adapter -> To Call the CPI as HTTPS Request(We are using Postman to call and pass the data)


HTTPS Sender Adapter - Connection


 

Content Modifier -> Why we are using the Content Modifier is to add Product tag(Since OData usually accepts XML as a payload) outside the JSON payload.


Content Modifier - Message Body


 

JSON to XML Converter -> To send payload as XML Format.


JSON to XML Converter - Processing


 

Below is the sample XML format that accepts OData for Post Call in Products Entity Set.
<?xml version="1.0" encoding="UTF-8"?>
<Products>
<Product>
<ID>12</ID>
<Name>Earphone</Name>
<Description>Test</Description>
<ReleaseDate>2023-10-08T00:00:00</ReleaseDate>
<DiscontinuedDate></DiscontinuedDate>
<Rating>3</Rating>
<Price>1900</Price>
</Product>
</Products>

For the abode XML code you may notice data is passed inside the Products and Product Tag. This is the reason we have added Content Modifier to add Product and in the JSON to XML Converter we are using Products as Name under Processing Tab.

Request reply and ODATA Receiver -> To Post data in OData Service.

Request Reply is used to connect the OData Receiver in Integration Flow.

Below is the OData Receiver Connection details which holds OData URL in the Address field


OData Receiver Connection


 

Below is the setup for OData Receiver Processing:


OData Receiver Processing


 

Choose Post Method as Operation Details and in the Resource Path, click the Select Button and

  1. Select Local EDMx File option in Connection Source.

  2. POST Method in Operation

  3. Products(In our Case) in Select Entity.

  4. Select All the Fields listed in the screen.

  5. Generate XML Schema Definite Checkbox is used to generate XSD file to get the XML format for our entity set.(It will be shown in the Resource Tab in the Integration Flow)


After you deploy your iFlow, you can see your End point URL generated in Manage Integration Content Tile which hold all your iFlows.


iFlow - Endpoint URL


 

ok, Let's test the Integration Flow from POSTMAN using above URL.


POSTMAN - Trigger the iFlow


 

Status - 201 Created, yes we have posted one Record in product entity set. Let's check the data now in OData Service.


POSTMAN - Fetch Records to Test


 

Yes, now our data got posted in the entity set and you can test the count of the same entity set.

 

Conclusion

In this Article, we have achieved how to call SAP OData Service using CPI from POSTMAN.

Please feel free to share and comment if you have any queries.

 

Best Regards,

Avinash

 
3 Comments
yash_vijay
Explorer
Hello avinash_3 ,

Thanks for your article!

I am trying to do something quite similar in my learning stage. Could you please share the details like service URLs and Payload you used from postman.

 

Thanks again
Marco_Fuentes
Explorer
0 Kudos

Thanks for your blog, 🙂

I have a question, how do I do if I want to POST on one or two levels of the API ? For example the API of the API_BUSINESS_PARTNER. I want to post on parameters of the A_BusinessPartner but also on the Address that would be in a lower level of navigation /A_BusinessPartner('{BusinessPartner}')/to_BusinessPartnerAddress

Do you have an example  ??

Frank1
Participant
0 Kudos

Thanks for sharing. Integration Suite seems very popular now in SAP ecosystem.

Labels in this area