Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
Showing results for 
Search instead for 
Did you mean: 
Product and Topic Expert
Product and Topic Expert
0 Kudos

Recently I was building an internal project using Hana and UI5. The basic idea was to create some tables on the backend and expose them with XSOData patched with a custom exit for creating the record on the backend.


That aside, the XSOdata code worked fine and it will worked with Postman so there was nothing fundementally wrong with the infrastructure as such but in UI5 it just did not work. I kept getting an error "undefined is not a function" deep within the bowels of Datajs which sits under the UI5 OData model.


After much hacking around i got it to the state where I had the following code in its simplist form:

var dataServiceUrl = "<my service url>";

var oModel = new sap.ui.model.odata.ODataModel(dataServiceUrl);

sap.ui.getCore().setModel(oModel, "AppData");

oObj = {

     field1: "one"

     field2: "two"







    function onSuccess(data) {



  function onError(error) {



The code to create works fine in postman and the object gets created but when it runs in UI5 the collection is returned but the post to create an object does not work. In fact it does not even make the http call to the server.

What appears to happen is when the service queries the backend it gets a list of supported datatypes and as is documented in the XSOData documents in Hana the backend only supports JSON when you have "XSOData exits". The default content type however for datajs is to use ATOM/XML which is thus incompatible and so the client attempts to generate an XML Feed document and crashes with "undefined is not a function".

Fortunatly the fix is quite simple. Change the model's default data type from XML/ATOM to JSON and the problem goes away:

We change this line:


var oModel = new sap.ui.model.odata.ODataModel(dataServiceUrl);


var oModel = new sap.ui.model.odata.ODataModel(dataServiceUrl, true /* <<--- This is the important bit */);

and that fixes the problem.

  • SAP Managed Tags:
Labels in this area