Skip to Content
0
Former Member
Dec 16, 2015 at 12:38 PM

Odata consumption in JS view

100 Views

Hello Everyone,

I tried to bind odata with my table but it doesnt bind any give no Data.

My webservice url is : http://********:***/sap/opu/odata/sap/ZCRAVE_WO_DETAILS_SRV/WoHeaderDtlSet?$filter=User eq 'SAPUSER' and ZappId eq 'ZMOB_WO' and ZmodId eq 'ZMOB_WO' and ZsmodId eq 'ZMOB_WO'

My table.view.js file code:

createContent: function(oController) {

//Create an instance of the table control

var oPage = new sap.m.Page({

title: "Company Details"

});

var oTable = new sap.m.Table({

id : "Table1",

columns: [

new sap.m.Column({

width: "1em",

header: new sap.m.Label({

text: "OrderNo."

})

})

]

});

var template = new sap.m.ColumnListItem({

id : "first_template1",

type: "Navigation",

visible: true,

selected: true,

cells: [

new sap.m.Label({

text: "{Plant}" //property in my web service

})

]

});

var oFilters = null;

oPage.addContent(oTable);

return oTable;

}

table.controller.js code is:

onInit: function() {

var oModel = new sap.ui.model.odata.ODataModel( "proxy/http/****:****/sap/opu/odata/sap/ZCRAVE_WO_DETAILS_SRV");

//Set the Model to the Table

var oTable = sap.ui.getCore().byId("Table1");

oTable.setModel(oModel);

// Filter the DATA

var FilterOperator = sap.ui.model.FilterOperator;

console.log(FilterOperator);

var filter = new sap.ui.model.Filter("Orderid",FilterOperator.EQ, "000004000000");

console.log(filter);

//Bind the Data to the Table

oTable.bindItems("/WoHeaderDtlSet",sap.ui.getCore().byId("first_template1"), null, filter);

}

i also added routes in neo-app.json file:

{

"path": "/sap/opu/odata/sap",

"target": {

"type": "destination",

"name": "devcenter",

"entryPath": "/sap/opu/odata/sap"

},

"description": "SAP dev center"

}

But i didnt get any output in table .

I am stuck with this problem .

Can anyone please help me how to solve this problem.