Skip to Content
0
Nov 18 at 08:52 AM

Creating entries in a custom table (in HANA Cloud) from an iFlow using OData API

129 Views Last edit Nov 18 at 08:53 AM 3 rev

Hello, I am currently exploring the capabilities of SAP ABAP Cloud Environment and SAP CPI/Integration Suite. My goal is to create a custom table with an OData service, that allows writing and reading entities in this table. Next, I would like to create an iFlow in SAP Cloud Integration (Integration Suite), which will create a new Entity via my OData. I have a trial account on BTP and a company account on SAP CPI.

Here are the ways that I tried to do it: I created a table, model, service binding and Odata in ABAP Cloud Environment (using this tutorial: Creating Simple Report in SAP Cloud Platform ABAP environment. Step-by-step guide | SAP Blogs). Then, I was able to call the service from Postman ( https://blogs.sap.com/2021/07/27/manual-testing-of-apis-in-sap-btp-abap-environment-using-postman/ ) BUT: When I wanted to access the service from SAP CPI it was not possible because I don’t have the access to Communication Management on my trial account in S/4HANA Cloud and so I couldn’t create a Communication Scenario.

Then I tried it another way: using this tutorial (https://blogs.sap.com/2020/10/07/odata-with-sap-hana-cloud-hands-on-video-tutorials/ ) I created a Schema with tables and an OData Service in HANACloud, then I created an OData API for this service in CPI, which I was able to call from Postman (GET and POST were working fine). I put this API in my iFlow and at first had authorization problems, but after creating oAuth2 Client Credentials I get this error:

Payload:

{"error":{"code":"400","message":{"lang":"en","value":"No payload deserializer available for resource kind 'ENTITY' and mime type 'application/atom+xml'"},"severity":"error","target":"/#TRANSIENT#","innererror":{"errordetails":[{"code":"400","message":{"lang":"en","value":"No payload deserializer available for resource kind 'ENTITY' and mime type 'application/atom+xml'"},"severity":"error","target":"/#TRANSIENT#"}]}}}

Exception:

com.sap.gateway.core.ip.component.odata.exception.OsciException: Bad Request : 400 : HTTP/1.1

The body of the request, which calls the iFlow is in xml and look like this:

<?xml version="1.0" encoding="UTF-8"?>
<Customers>
<Customers>
<id>99</id>
<name>Schmitz</name>
<city>Köln</city>
<gender>Female</gender>
<number_of_trips>1</number_of_trips>
<loyalty_member>false</loyalty_member>
<balance>1.99</balance>
</Customers>
</Customers>

Then it is directly used in the POST call for the OData service.

The metadata of the service is as follows:

<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:sap="http://www.sap.com/Protocols/SAPData">
<edmx:DataServices m:DataServiceVersion="2.0">
<Schema Namespace="CatalogService" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityContainer Name="EntityContainer" m:IsDefaultEntityContainer="true">
<EntitySet Name="Customers" EntityType="CatalogService.Customers"/>
<EntitySet Name="LOYAL_CUSTOMERS" EntityType="CatalogService.LOYAL_CUSTOMERS"/>
</EntityContainer>
<EntityType Name="Customers">
<Key>
<PropertyRef Name="id"/>
</Key>
<Property Name="id" Type="Edm.Int32" Nullable="false"/>
<Property Name="name" Type="Edm.String" MaxLength="30" Nullable="false"/>
<Property Name="city" Type="Edm.String" MaxLength="100"/>
<Property Name="gender" Type="Edm.String" MaxLength="6"/>
<Property Name="number_of_trips" Type="Edm.Int32"/>
<Property Name="loyalty_member" Type="Edm.Boolean"/>
<Property Name="balance" Type="Edm.Decimal" Scale="2" Precision="6"/>
</EntityType>
<EntityType Name="LOYAL_CUSTOMERS">
<Key>
<PropertyRef Name="id"/>
</Key>
<Property Name="id" Type="Edm.Int32" Nullable="false"/>
<Property Name="name" Type="Edm.String" MaxLength="30" Nullable="false"/>
<Property Name="city" Type="Edm.String" MaxLength="100"/>
<Property Name="trips" Type="Edm.Int32"/>
<Property Name="balance" Type="Edm.Decimal" Scale="2" Precision="6"/>
</EntityType>
</Schema>
</edmx:DataServices>
</edmx:Edmx>

Could someone please point me in the right direction? The google search for the error “No payload deserializer available for resource kind 'ENTITY' and mime type 'application/atom+xml' “doesn’t give any helpful results…

Or maybe there is yet another way of creating entries in a custom table via an iFlow? I really thought this should be easy…