Skip to Content
Former Member
Oct 09, 2014 at 11:34 AM

Putting oData into sap.m.Table


Hi Guys,

sorry to bother you again, but developing SAP Fiori like Uis is really hard for me. Right now I can't get the Data from an oData Service into a simple sap.m.Table. This is how the oData Object that I get from the Service looks like:

As you can see, I have two Objects in the results Array. Each object contains Strings which I want to display in a sap.m.Table. This is my JS code for the table:

initBHeftModel : function(context) {
  // Using OData model to connect against a real service
  var VersBP = context.getObject().bp;
  var url = "proxy/http/";
  var oModel = new sap.ui.model.odata.ODataModel(url, false);
  var filterArray = new Array();
  var BPFilter = new sap.ui.model.Filter("Bpartner", sap.ui.model.FilterOperator.EQ, VersBP);
  var params = {
  context : null,
  urlParameters : null,
  async : false,
  filters : filterArray,
  sorters : null,
  success : function(oData, response) {
  var JSONBHeft = new sap.ui.model.json.JSONModel();
  sap.ui.getCore().setModel(JSONBHeft, "VersBHeft");
  var bhtable = sap.ui.getCore().byId("bheftPageId").byId("BHeftTable");
  var oTemplate = new sap.m.ColumnListItem(  
   {cells: [   
           new sap.m.Text({text : "{Guid}"}),  
           new sap.m.Text({text : "{Kjahr}"}),
           new sap.m.Text({text : "{Hjahr}"})
  bhtable.bindItems("/VersBHeft/oData/results", oTemplate);
// bhtable.bindAggregation("items", "/VersBHeft/oData/results", oTemplate);
  error : function(err) {

  };"BonuseintragSet", params);


This might show all the stuff that I tried to get the data into the table. The function gets called, when someone selects a field in the Master view. The table in the Detail view only shows No Data.....and it did this for hours.....

I read a lot other discussions about similar problems, but I have the problem, that I cannot transfer those solutions to my oData Structure. I guess that I am not addressing the data in the right way.

I am looking forward hearing from you 😊


sap2.PNG (44.1 kB)