Skip to Content
avatar image
Former Member

Consume Odata service in a Ui5 table in Eclipse Application

Hello Ui5 Experts,

I have started learning Ui5 and I am struck with the basic process.

I have an Ui5 application running on abap server. I have created an odata service and it returns the values when its run as a url. But when I try to populate the table with just 1 data it is not displaying. I am not sure whether its getting the data to the table or not. I have tried all the methods given in the forum and tried googling in different formats. But I am not getting the value in my table. I have attached my code below.

Controller Code:

var domainString = "document.domain";

domainstring = "*.com";

'Access-Control-Allow-Origin: *.local.com';

'Access-Control-Allow-Headers: X-KEY';

var oModel = new sap.ui.model.odata.ODataModel("proxy/http/serverdetails/sap/opu/odata/sap/Z_DS_EMP_PORTAL_SRV/",true,"uname","pwd");

sap.ui.getCore().setModel(oModel);

var oTable = new sap.ui.table.Table({ editable: false, });

oTable.setModel(oModel);

oTable.addColumn(new sap.ui.table.Column({ label: new sap.ui.commons.Label({text: "Name"}),

template: new sap.ui.commons.TextField().bindProperty("value", "Name"),

editable: false, sortProperty: "Name" }));

oTable.addColumn(new sap.ui.table.Column({ label: new sap.ui.commons.Label({text: "Bname"}),

template: new sap.ui.commons.TextField().bindProperty("value", "Bname"),

sortProperty: "Bname", editable: false, }));

oTable.addColumn(new sap.ui.table.Column({ label: new sap.ui.commons.Label({text: "Telephone"}),

template: new sap.ui.commons.TextField().bindProperty("value", "Telephone"),

sortProperty: "Telephone", editable: false, }));

oTable.addColumn(new sap.ui.table.Column({ label: new sap.ui.commons.Label({text: "Emailid"}),

template: new sap.ui.commons.TextField().bindProperty("value", "Emailid"),

sortProperty: "Emailid", editable: false, }));

oTable.bindRows({path : "/ZEMP_LOGINSet"},null,["$filter=Bname eq 'DHIVYAS' and Pwd eq '00000000000000000000000000000000'"]);

oMasterShell.setContent(oTable);

Below is My URL result

I have made the 'proxy/http' change recently after seeing a website still it doesnt work.Initially I had "http://serverdetails"

I tried to debug in IE when I keep the debbugger in oModel it says 'odata' is undefined

Final Screen:

Sorry if I had asked very simple one. But i have been banging my head with this issue for so many days.

I hope i am clear on my question. Please help me where I am wrong.

Thanks in Advance

Dhivya

3.png (11.0 kB)
4.png (5.5 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Mar 02, 2017 at 01:36 AM

    very complex for junior.

    can u just deploy to gateway server to run. it will be very simple.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 16, 2017 at 01:37 AM

    I think you already read this guide

    https://sapui5.hana.ondemand.com/sdk/index.html#docs/guide/510d6eeed849447fbf497cfa5b640514.html

    If it doesn't work, you can disable web security option for Chrome.

    Add arguments to Chrome shortcut.

    ".....chrome.exe" --user-agent --disable-web-security

    Add comment
    10|10000 characters needed characters exceeded