Skip to Content
avatar image
Former Member

The Following error occurred: No Handler for Data

Hi,

I was making a read function for my oDatamodel, but after running my application i get this error when i check my console in Chrome:

The following problem occurred: no handler for data -

This is the function which contains the read function. For some extra information i am using the sap.ui.model.odata.v2.ODataModel for this application.

  _downloadFile: function() {

  var oModel = this.getView().getModel();
  var selectedDocument = this.getView().getBindingContext().getObject();
  var sRead ="/PDFSet(MyDocKey='',SCObjid='',AcadYear='',AcadPeriod='',Cokey='"+selectedDocument.Cokey+"',Cotyp='"+selectedDocument.Cotyp+"')/$value";


  oModel.read(sRead, {
    success: function(oData, oResponse){
        console.log(".. oModel.read success: " + oData.results.length);
        console.log(oData);
        console.log(oResponse); 
    },
    error: function(oError){
      console.log(".. oModel.read failed");
      var errorObj1 = JSON.parse(oError.responseText);  
      console.log(errorObj1);
    }
});


  }

I hope you can help me figure out what i am missing or doing wrong.


Kind Regards,


Arun


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Feb 02, 2016 at 01:39 PM

    Hi Arun,

    Have you tried calling the read function like below (2 null parameters for context and urlParameters):

    Reference - SAPUI5 SDK - Demo Kit

    oModel.read(sRead, null, null, 
         function(oData, oResponse){.....}, 
         function(oError){....}
    );
    

    Regards,

    Saurabh

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 02, 2016 at 03:37 PM

    Hi Arun,

    Would you mind to put a breakpoint in the first line of the function and then check in which line it is throwing th error ?

    Regards,

    Gairik

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Arun,

      Please try one of the following

      1. Please pay attention to the details that parameter name "success" should NOT be used here

      1. oModel.read(sRead, { 
      2.    null, null,true, function(oData, oResponse){ 
      3.         console.log(".. oModel.read success: " + oData.results.length); 
      4.         console.log(oData); 
      5.         console.log(oResponse);  
      6.     }, 

      OR

      2.This is call with the parameter names.

      1.   oModel.read(sRead, { 
      2.    context : null,
      3. urlParameters : null,
      4. async : true,
      5.     success: function(oData, oResponse){ 
      6.         console.log(".. oModel.read success: " + oData.results.length); 
      7.         console.log(oData); 
      8.         console.log(oResponse);  
      9.     }, 
  • avatar image
    Former Member
    Feb 08, 2016 at 02:25 PM

    Hi everyone,

    We have tried something else. We also tried using the jQuery.proxy, but still we get the
    no handler for data message.

    This is the function we made:

    fSuccess : function(oEvent){
         console.log(oEvent);
         console.log("succes");
    },
    fError : function(oEvent){
       console.log(oEvent);
        console.log("error");
    },
    _downloadFile : function (){
    var oModel = this.getView().getModel();
    var selectedDocument = this.getView().getBindingContext().getObject();
    var sRead = "/PDFSet(MyDocKey=' ', SCObjid=' ',AcadYear=' ', AcadPeriod = ' ', Cokey = ' " + selectedDocument.Cokey + "', Cotyp= '" + 
    selectedDocument.Cotyp + "' )/$value";
    }
    
    oModel.read(sRead, {
    success : jQuery.proxy(this.fSuccess, this),
    error: jQuery.proxy(this.fError, this)
    });
    },
    

    When we run the the following will be shown in the console

    and when we are debugging we see the following:

    I hope you can help me solve this

    Kind regards,

    Arun

    Add comment
    10|10000 characters needed characters exceeded