Skip to Content

Error POSTing to HANA XSOdata

Feb 05, 2017 at 03:47 AM


avatar image

I am attempting to POST/create a new entry to an XS Odata Service on HANA via a UI5 app. We are using Gateway to connect to the oData service on HANA as opposed to connecting directly. I am not 100% why, though I believe it has to do with authentication and SSO; gateway will handle that for us as opposed to having to configure it on HANA.

Here is the XS oData Service:

   "system-local.public.timmo.timmoSbx::cv_user" as "User"
   key ("NAME")
   create using "system-local.public.timmo.timmoSbx::insert_user"; 

Here is the gateway service configuration:

There are no issues reading the data and displaying it on a table in a WebIDE UI5 app; manifest.json configuration points to /ZXS_TIMMO_SRV/ service on our Dev environment.

Here is the metadata:

<edmx:Edmx xmlns:edmx="" Version="1.0">
<edmx:DataServices xmlns:m="" m:DataServiceVersion="2.0">
<Schema xmlns:d="" xmlns:m="" xmlns="" Namespace="system-local.public.timmo.timmoSbx.timmoSbx">
<EntityType Name="UserType">
<PropertyRef Name="NAME" />
<Property Name="NAME" Type="Edm.String" Nullable="false" MaxLength="40" />
<Property Name="EMAIL" Type="Edm.String" MaxLength="40" />
<Property Name="PHONE" Type="Edm.String" MaxLength="15" />
<EntityContainer Name="timmoSbx" m:IsDefaultEntityContainer="true">
<EntitySet Name="User" EntityType="system-local.public.timmo.timmoSbx.timmoSbx.UserType" />

Here is the procedure used to insert the record:

PROCEDURE "TIMMO"."system-local.public.timmo.timmoSbx::insert_user" (
in row "TIMMO"."USER",
out error "TIMMO"."TT_ERROR")   
	Write your procedure logic 
declare name string;
declare email string;
declare phone string;
select "NAME","EMAIL","PHONE"
into name,email,phone
from :row;  

if (:name = ' ' OR :email = ' ' OR :phone = ' ') then
       error = select 400 as http_status_code,
                     'empty field' as error_message,
                     'All fields must be filled' as detail from dummy;

insert into "TIMMO"."USER" values (:NAME, :EMAIL, :PHONE);
end if;

I have confirmed I can successfully create an entry sending a JSON request directly to the service via Postman:

Here is the function I am using to submit the entry via UI5:

	_submitUser: function() {
		var oModel = this.getView().getModel();
		var mNewEntry = {};
	mNewEntry.NAME = this.byId("sName").getValue();
	mNewEntry.EMAIL = this.byId("sEmail").getValue();
	mNewEntry.PHONE = this.byId("sPhone").getValue();

       oModel.create("/User", mNewEntry, null, function() {"User Added Sucessfully");
		}, function() {"Please Check Record");

When I try to submit and entry via a UI5 form, I get the following error:

	"message": "HTTP request failed",
	"headers": [],
	"statusCode": 500,
	"statusText": "Internal Server Error",
	"responseText": "{\"error\":{\"code\":\"/IWBEP/CM_OCI/042\",\"message\":{\"lang\":\"en\",\"value\":\"Create Entity failed: <HUGE_BLOB_OF_TEXT>.\"},\"innererror\":{\"application\":{\"component_id\":\"\",\"service_namespace\":\"/SAP/\",\"service_id\":\"ZXS_TIMMO_SRV\",\"service_version\":\"0001\"},\"transactionid\":\"DDF3EAE62F1EF1AC80DA005056816E4D\",\"timestamp\":\"20170204160620.3700000\",\"Error_Resolution\":{\"SAP_Transaction\":\"Run transaction /IWFND/ERROR_LOG on SAP Gateway hub system and search for entries with the timestamp above for more details\",\"SAP_Note\":\"See SAP Note 1797736 for error analysis (\"},\"errordetails\":[{\"code\":\"/IWBEP/CX_OCI_TECH_EXCEPTION\",\"message\":\"Create Entity failed: <HUGE_BLOB_OF_TEXT>\",\"propertyref\":\"\",\"severity\":\"error\",\"target\":\"\"}]}}}"

Here is what I am sending:

And the response:

I assume there is something configured incorrectly on gateway (perhaps we missed a step when configuring the service), or I am somehow not sending the correct payload. Gatewy error logs don't really show much more than what is displayed in the image above. The only difference I can see between what works via Postman and what is not working via the UI5 form is the key names have no quotes on the payload sent form the from the UI5 app (i.e NAME vs "NAME"). When I try to create via Postman and my key names are not in quotes, I get an error.

Hopefully it's something simple, and I have provided enough info to make this useful to someone else. Any help is appreciated!



10 |10000 characters needed characters left characters exceeded

Hi Tim,

I try to replicate your issue on my NetWeaver ABAP 7.50 Developer Edition. With the help of the documentation Configure SSO with SAP Logon Tickets for SAP HANA XS Applications I made SSO with Logon Tickets work from my ABAP Stack to the HANA system. I've created a destination similar to yours that is set to Send a Logon ticket. I've tested that the SSO works by using my PoC Application you can check out at GitHub. There I have the hello.xsjs script which returns the current user. When I provide the URL to this script in the SM59 destination and test it the correct User is returned.

I now try to create the External OData Service as I guess you've did according to what I see from the screenshot above and the Documentation Generating an SAP Gateway Service for OData I enter in the first step:


to finally get the error:

Have you done anything different? Could you try with the project I've published on GitHub if you get the same error?

Best regards

* Please Login or Register to Answer, Follow or Comment.

3 Answers

Gregor Wolf
Mar 07, 2017 at 11:40 PM

Hi Tim,

if your HANA System is not exposed to the outside world you could add:

"prevent_xsrf" : false

to the .xsaccess file where your xsodata service lives.

Best regards

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Faced the same issue, and Gregor's answer was really helpful. Thanks

Veeraraghavan Narasimhan
Feb 06, 2017 at 02:32 AM

Hello Tim,

One thing that comes to my mind is you need to stringify your json object.

Can you try changing your code to

oModel.create("/User", JSON.stringify(mNewEntry), null, function() {"User Added Sucessfully");
		}, function() {"Please Check Record");

The newEntry is sent as a string. Maybe this will not help. Also can you capture the request url of for the function import you are trying to execute.

Thanks and Regards,


Show 2 Share
10 |10000 characters needed characters left characters exceeded

Thanks Veera, I will try using the JSON.stringify function. I have tested this create method directly against the HANA DB (not going through GW), and I have confirmed it is working.

Can you please elaborate on what you mean by 'capture the request URL for the function import'? Are you referring to the URL that is called during the POST method? I can get this from the debugger window in my browser?




I get a different error when I use the JSON.stringify() function; a '400/Bad Request/Error while Parsing an XML String' error.

When I look at the request payload, I am not seeing anything being sent.



stringify.png (6.0 kB)
Gregor Wolf
Mar 07, 2017 at 11:29 PM

Hi Tim,

as suggested in the OpenUI5 Slack channel I would suggest the following:

As the HANA System is already configured for SSO using SAP Logon Tickets ask your Basis team to put a SAP Web Dispatcher in front of HANA and Gateway. Then direct the OData calls to HANA and the SAPUI5 App request to the Gateway? That’s the way SAP suggests it for Suite on HANA. See:!/overview.

Best regards

10 |10000 characters needed characters left characters exceeded