Skip to Content
0
May 11, 2020 at 08:16 AM

oData.read function do not enter success or error function

146 Views

Hi there,

I am trying to do an oData.read 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 , {});
sap.ui.getCore().setModel(oModel);
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
              oODataJSONModel.setData(oData);
              
              sap.ui.getCore().setModel(oODataJSONModel, "localModel");
            
        }, function(oError){
        alert("Reading failed: " + oError);
        });

Thanks and best regards.

Jay