Quantcast
Channel: SCN: Message List - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 8124

Re: SAPUI5 oData Connection Error

$
0
0

Hi Melanie,

 

when using an oData model, the runtime reads the "metadata" document for the specified oData service. In the example above, when you create the model with the URL "https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZCD204_EPM_DEMO_SRV" the metadata document should be requested with the URL "https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZCD204_EPM_DEMO_SRV/$metadata" which is working fine on my side.

 

But you are saying that the system tries to follow the link "

https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZCD204_EPM_DEMO_SRV/SalesOrders/$metadata" which produces an error on my side too. Could you please recheck the URL you are using when you instantiate the model?

 

Regards, Frank

 

P.S.: Here is a very brief example for accessing sales orders:

var result = new sap.ui.model.odata.ODataModel("proxy/https/sapes1.sapdevcenter.com/sap/opu/odata/sap/ZCD204_EPM_DEMO_SRV");
sap.ui.getCore().setModel(result);
// Create the column templates
var nameColumnTemplate = new sap.ui.commons.TextField({
 value: "{CustomerName}"
});
var sumColumnTemplate = new sap.ui.commons.TextField({
 value: "{TotalSum}"
});
var oTable = new sap.ui.table.Table({ // create Table UI 
 columns : [   {label: "Name", template: nameColumnTemplate  },     {label: "Sum", template: sumColumnTemplate }
 ]
});    
oTable.setModel(result); // bind JSON model to Table        
oTable.bindRows({path: "/SalesOrders"} ); // bind the table rows to an array
oTable.placeAt("content"); // place Table onto UI

 

Message was edited by: Frank Welz Example added.


Viewing all articles
Browse latest Browse all 8124

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>