Skip to Content

Reading oData from sapAS java system

Hi All,

I,m trying to read data from SAP AS java system.

var formModel = sap.ui.model.odata.ODataModel("proxy/http/XXXXXXXXXXXXX/service", "username", "pwd");

var path = "/mycollection?$expand=abc&$format=json";

formModel.read(path,auth,true, function(oData, oResponse){

console.log(oData);

},function(){

alert("Read Unsuccessful");

});

i tried using above code but its working fine and showing 200 statusCode but the problem is empty object even though i have data.

for more information PFA.

so any suggestions.

Thanks & Regards

Venkat.

ra1.PNG (61.3 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Aug 10, 2016 at 01:54 PM

    Hello,

    Finally my issue is solved i used AJAX call to get data and here is my code

    $.ajax({

    url : "proxy/http/XXXXXXurl?$expand=abcollection&$format=json",

    type: "GET", //or POST?

    dataType: "json",

    xhrFields:

    {

    withCredentials: true

    },

    beforeSend: function (request)

    {

    request.setRequestHeader('Authorization', 'Basic ' + btoa('username:password'));

    },

    success: function(odata,oresponse){

    debugger;alert("ok")

    }

    });

    Regards

    Venkat

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 09, 2016 at 01:22 PM

    Hi Venkat,

    If you look closely at your screenshot it indicates that the model has an invalid metadata document. It would seem that the metadata on the back end service needs to be updated and then maybe you can try again.

    Regards,

    Ryan Crosby

    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.