Skip to Content function do not enter success or error function

Hi there,

I am trying to do an where in success function I am creating a JSON-Model from oData, but its not entering success or error function. Can someone tell me what I am doing wrong? Here my Code:

var sServiceUrl = "/sap/opu/odata/sap/ZPP_ODATA_UMLAGERUNG_SRV/";
var oModel = new sap.ui.model.odata.v2.ODataModel( sServiceUrl , {});
var oFilter = new Array();
var input = mResult.text;
oFilter[0] = new sap.ui.model.Filter({
                path: "Lenum",
                operator: sap.ui.model.FilterOperator.EQ,
                value1: input

sap.ui.getCore().getModel().read("/LEINSet", null, null, oFilter, function(oData, response){
            // create JSON model
              var oODataJSONModel =  new sap.ui.model.json.JSONModel();
              // set the odata JSON as data of JSON model
              sap.ui.getCore().setModel(oODataJSONModel, "localModel");
        }, function(oError){
        alert("Reading failed: " + oError);

Thanks and best regards.


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on May 11 at 09:32 AM

    The read function of the odata model has only two parameters. The first one is the path and the second one is an options object. So you have to called it like following:

    .read("/LEINSet", {
      success: function(oData, response) {
        // your logic
      error: function(oError) {
        // your logic
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 11 at 11:19 AM

    Hi Jay Niclas Kiefer, supports both Success and error function.

    Please check console, if there is any error and also check your network if the call is happening properly and is returning results."/YourEntitySet", {
    success: function (oData, response) { 
    //your logic
    }, rrror : function  (oData, response) {
    //your logic
    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.