Skip to Content

SAPUI5 OData read doesn't work properly

Hi altogether,

I am writing my first own list report based on SAPUI5 with SAP Web IDE in SCP. I am Standing at the point, getting the data from my own odata-service from backend. The following coding doesn't give back the data in the oData-Object.

Setting a breaktpoint in backend, get_entityset is called correctly and the data is wirtten to et_entityset. If i call the service manually per URL in browser, it works perfect and gives back the data in XML format. What seems a little bit strange to me: in network tab of development tools, I can't see the GET request I expect.

What am i missing or doing wrong?

thanks in advance and best regards

Christian"Z_HCM_CICO_REP.Component");"");"");"Z_HCM_CICO_REP.Component", {
metadata: { 
	"manifest": "json" 
], function(UIComponent, Device) { 
	"use strict";
 	return UIComponent.extend("Z_HCM_CICO_REP.Component", {

 /**  * The component is initialized by UI5 automatically during the startup of the app and calls the init method once.  * @public  * @override  */ 
	init: function() { 
		// call the base component's init function
		UIComponent.prototype.init.apply(this, arguments);
		var oResourceModel = new sap.ui.model.resource.ResourceModel({
			bundleName: "Z_HCM_CICO_REP.i18n.i18n"
			sap.ui.getCore().setModel(oResourceModel, "i18n");
			//load cicos
			var sServiceUrl = "/sap/opu/odata/sap/ZHCM_CICO_REP_SRV/";
			var oModel = new sap.ui.model.odata.v2.ODataModel(sServiceUrl, true);
			var oJsonModel = new sap.ui.model.json.JSONModel(); this.setModel(oModel);"/TimeEntrySet", null, null, false, function(oData, oResponse) {
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Feb 27, 2018 at 08:58 AM

    hi Christian,

    The syntax of the method being used is incorrect.

    You have declared a odata.v2.ODataModell whereas you are using syntax for older version of odata.OdataModel.

    Please use the new syntax and your code should work as expected."/TimeEntrySet", {
    success : function(oData, oResponse) {
    			} ,
    error : function(oError) {
    				// Error Handling Here


    Vaibhav Maheshwari

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 27, 2018 at 09:47 AM

    Hi Vaibhav,

    thank you. I corrected the coding, but the problem still persists. I attached a picture that shows, that oData is undefined. Could I have something wrong in the other parts of the application e. g. in manifest.json?


    best regards


    Add comment
    10|10000 characters needed characters exceeded

    • Hi Vaibhav,

      indeed it was a handling mistake from myself. Setting the break point in line 44 shows the correctly filled oData-variable. What I don't understand: Why wasn't it filled in my first approach, setting the break point before and then jump manually over the function call with F10 in Chrome development tools?

      thanks and best regards