Skip to Content

Error POSTing to HANA XSOdata

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!



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • 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

    Add comment
    10|10000 characters needed characters exceeded

  • 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,


    Add comment
    10|10000 characters needed characters exceeded

  • 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

    Add comment
    10|10000 characters needed characters exceeded