I have configured the information for accessing my OData Service from SAP UI5 in the manifest.json
{
"sap.app": { ...
},
"dataSources": {
"Test": {
"uri": "/sap/opu/odata/sap/ZHCM_SRV/",
"type": "OData",
"settings": {
"odataVersion": "2.0",
"localUri": "localService/metadata.xml"
}
}
} ...
"sap.ui5": {
"rootView": {
"viewName": "test.view.App",
"type": "XML",
"id": "app"
}, ...
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "test.i18n.i18n"
}
},
"Test": {
"type": "sap.ui.model.odata.v2.ODataModel",
"settings": {
"defaultOperationMode": "Server",
"defaultBindingMode": "TwoWay",
"defaultCountMode": "None"
},
"dataSource": "Test"
}
},
"routing": { ...
}
In my Component.js I have:
init: function() {
UIComponent.prototype.init.apply(this, arguments);
this.getRouter().initialize();
this.setModel(models.createDeviceModel(), "device");
// I get the Url from configuration in Manifest.json
var sServiceUrl = this.getMetadata().getManifestEntry("sap.app").dataSources["Test"].uri;
// I create the OData
var sabModel = new sap.ui.model.odata.v2.ODataModel(sServiceUrl);
// Load the MetaData.
sabModel.getServiceMetadata();
// Binding to the Model.
this.setModel(sabModel, "Sabbatical");
when I am checking the oModel I can see I have instantiated the Model but it is empty, no data... Have you had this behavior? Any suggestion???
Thanks a lot!! CBR