How to configure/consume OData Service in SAP CPI

Estimated read time 4 min read

This blog will teach you how to consume OData service in an i-Flow also you can learn about OData/HTTP/SFTP adapter configuration & the utilization of XML to CSV converter in our i-Flow.

Introduction

You can develop OData APIs that expose existing data sources, such as SOAP, as OData endpoints. These OData APIs can be consumed by SAP Fiori apps,Ā SAP BTPĀ Mobile Services, or any other custom app, to implement user-centric scenarios –SAP help portalĀ Developing an OData API ProjectĀ 

Ā 
OData Operations:
OData is a way of performing database-styleĀ create, read, update, and deleteĀ operations on resources through HTTP verbs – SAP Learning

Let’s start creating simpleĀ OData service
Here in this i-flow we are going to send request via HTTPS adapter using postman that request will be sent to OData service and the response that we get from OData service will be stored as a .csv file using SFTP adapter
Ā Step 1:
Configure HTTPS and SFTP adapters as per my previous blogĀ 
Step 2:
Ā 
Add request and reply pallet function in between Start and End message functionsĀ 
Step 3:
Take one more receiver from the Participant name it as ODATASERVICE and connect it to Request Reply using OData adapter with OData v2 protocol.

Step 4:

In this Flow we are going use below free OData serviceĀ 
https://services.odata.org/v3/northwind/northwind.svc

Step 5:
In processing tab choose Resource path click on Select & click on step 2 and select the entity as per your requirement in this blog I am selecting Employees as shown below

-select the Operation as Query as we are fetching the Employee Details.

After selecting the Entity select all the fields as shown below an d click on finish so that it will automatically generate a Query


Ā 

Step 6:
Now I am adding XML to CSV converter to convert the response data that we get from OData service and to send .csv file to the target system

Finally save and deploy the i-flow and trigger the data from Postman to check the result


If you look at the above screenshot we have successfully received response of Employees data from OData service and converted to csv format.

Please feel free to post a query in the comments section if you have any inquiries.

Thank you and Happy Integrating

Ā 

Ā 

Ā 

Ā 

Ā 
Ā 

Ā 

Ā 

Ā 

​ This blog will teach you how to consume OData service in an i-Flow also you can learn about OData/HTTP/SFTP adapter configuration & the utilization of XML to CSV converter in our i-Flow.IntroductionYou can develop OData APIs that expose existing data sources, such as SOAP, as OData endpoints. These OData APIs can be consumed by SAP Fiori apps,Ā SAP BTPĀ Mobile Services, or any other custom app, to implement user-centric scenarios -SAP help portalĀ Developing an OData API ProjectĀ Ā OData Operations:OData is a way of performing database-styleĀ create, read, update, and deleteĀ operations on resources through HTTP verbs – SAP LearningLet’s start creating simpleĀ OData serviceHere in this i-flow we are going to send request via HTTPS adapter using postman that request will be sent to OData service and the response that we get from OData service will be stored as a .csv file using SFTP adapterĀ Step 1:Configure HTTPS and SFTP adapters as per my previous blogĀ Step 2:Ā Add request and reply pallet function in between Start and End message functionsĀ Step 3:Take one more receiver from the Participant name it as ODATASERVICE and connect it to Request Reply using OData adapter with OData v2 protocol.Step 4:In this Flow we are going use below free OData serviceĀ https://services.odata.org/v3/northwind/northwind.svcStep 5:In processing tab choose Resource path click on Select & click on step 2 and select the entity as per your requirement in this blog I am selecting Employees as shown below-select the Operation as Query as we are fetching the Employee Details.After selecting the Entity select all the fields as shown below an d click on finish so that it will automatically generate a QueryĀ Step 6:Now I am adding XML to CSV converter to convert the response data that we get from OData service and to send .csv file to the target systemFinally save and deploy the i-flow and trigger the data from Postman to check the resultIf you look at the above screenshot we have successfully received response of Employees data from OData service and converted to csv format.Please feel free to post a query in the comments section if you have any inquiries.Thank you and Happy IntegratingĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Read MoreĀ Technology Blogs by Members articlesĀ 

#SAP

#SAPTechnologyblog

You May Also Like

More From Author