Skip to Content
author's profile photo Former Member
Former Member

Omodel .Create () fails everytime

Dear UI5 Experts,

I am Facing the Issue while calling the Omodel .Create () method.I am passing the Passing parameters as method Suggests.

Kindly Help me ....



Snipp2.PNG (7.3 kB)
Snipp1.PNG (8.1 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Jul 25, 2016 at 08:43 AM

    is the hostname and port number on the Service URL exactly the same as what your UI5 is running on?

    eg. you are accessing the UI5 with 'http://hostA:8010' and the service url passed to OData model's create method is also 'http://hostA:8010' ?

    if not, then this may likely be the ubiquitous 'cross-origin resource security' issue.

    do you see any error message(s) in the browser console?

    Add a comment
    10|10000 characters needed characters exceeded

    • would be great to share the 'Request Headers' and 'Response' output in the browser dev tools "Network" tab for the POST request here 😉

      if you indeed had CSRF-token issue earlier and solved that by setting the request headers according to the article you posted ... then it's probably down to the actual payload (data) in the request

      care to share the coding of how did you setup and populate the properties in 'oEntry' ? (that would end up as the 'data' property set in the POST request)

  • Posted on Jul 25, 2016 at 10:14 AM

    Hi Srikanth,

    For posting please check the following piece of code:

    var oModel = new sap.ui.model.odata.oDataModel(url,false);











    I think you missed syntax.

    Once u check the URL and the PATH you are giving.

    Please refer this link for detail explanation:

    OData Write Support - UI Development Toolkit for HTML5 (SAPUI5) - SAP Library


    Deepak Raj.

    Add a comment
    10|10000 characters needed characters exceeded

    • if it is error 400 bad request then it will show you some error
      In the error there will be filed like value and message in that filed you may get the error description.

      And Check once the field names are correct or not as per the backend system.

      For example if you want pass the name then

      If in the backend the field name is "name1" then it will say the bad request.

      It will be helpful if you attach a screenshot of that error from the console.



  • Posted on Jul 25, 2016 at 11:51 AM


    It might be an authorization problem, a missing parameter, endpoint not available, and so on. For a better clarity of the issue, use class sap.ui.model.odata.v2.ODataModel instead, and implement the following methods:


    createEntry() method
    var context = this.getModel().createEntry("{EntityName}", {
      success: this._onCreateSuccess.bind(this), // optional
      error: this._onError.bind(this) // optional but necessary in some cases, like yours


    submitChanges() method: triggered in a save button

    _onCreateSuccess: private method - Notice that its method is invoked after a successful OData input

    _onCreateSuccess(Object): on creating successful

    _onError: private method - Errors occured when inserting data, therfore the method below shows you what happened

    _onError(oError): the error callback function
    console.log(oError); // oError contains additional information

    Kindly regards,

    Arthur Silva

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.