cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Gateway ODATA service not able to populate data in Table in SAP UI5

Former Member
0 Kudos

Hello UI5 Gurus,

Please note that I am trying to build one simple UI5 application where I am trying to fetch datas from backend SAP through ODATA service and trying to show them in a table format in sap UI5.Below is the code

<script>

var oTable = new sap.ui.table.Table({ title: "Outstanding Balance", visibleRowCount: 5, //firstVisibleRow: 5, selectionMode: sap.ui.table.SelectionMode.Single });

oTable.addColumn(new sap.ui.table.Column({ label: new sap.ui.commons.Label({text: "CustomerID"}), template: new sap.ui.commons.TextField().bindProperty("value", "Customer"), //sortProperty: "Customer", //filterProperty: "Customer", width: "200px" }));

oTable.addColumn(new sap.ui.table.Column({ label: new sap.ui.commons.Label({text: "Name"}), template: new sap.ui.commons.TextField().bindProperty("value", "Name"), //sortProperty: "Name", //filterProperty: "Name", width: "100px" }));

var oModel = new sap.ui.model.odata.ODataModel( "/sap/opu/odata/sap/Z_ATC_CUSTOMER_OUTSTANDING_SRV",true,"ABAP","123");

console.log(oModel);

oTable.setModel(oModel); // bind path of oDataModel to table rows oTable.bindRows("/CUSTOMERSet");

oTable.placeAt("content"); //} //})

</script>

Accepted Solutions (1)

Accepted Solutions (1)

former_member340030
Contributor
0 Kudos

Hi ,

Can you just tell me what's this "true" , "ABAP" and "123" in below statement :

var oModel = new sap.ui.model.odata.ODataModel( "/sap/opu/odata/sap/Z_ATC_CUSTOMER_OUTSTANDING_SRV",true,"ABAP","123");

thanks

Viplove

Former Member
0 Kudos

Hello Viplove,

I am passing the parameters in the ODataModel method and they are userid and password. And True is standard parameter passed.

Please let me know if I am wrong anywhere

former_member340030
Contributor
0 Kudos

Hi Arijit ,

Why to pass password , it will be prompt once when you doesn't provide in code. If you still want to provide password , just try to send like this :

var oModel = new sap.ui.model.odata.ODataModel( "/sap/opu/odata/sap/Z_ATC_CUSTOMER_OUTSTANDING_SRV",{ user: 'ABAP' , password:'123' ,json:true});

i dont know which standard parameter but please follow this api reference to check what all parameters you need to pass in the odata model.

thanks

Viplove

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello ,

The program is working fine now. The problem was that the entity set mentioned while binding the row was given wrongly. Hence the ODATA was not able to fetch the data.

I would thank everyone for your help and support

Thanks

Arijit

architectSAP
Active Contributor
0 Kudos

Hello Arijit,

Have you been building your SAPUI5 application from scratch? In this case I would recommend that you start with a template from Web IDE which will guide you through selecting your OData service. You can then either extend the template application or at least examine the code to reuse in your own SAPUI5 application.

Best regards

Frank

Former Member
0 Kudos

Yes I am trying to build one application for one of my client for which I have to retrieve the data from the backend through ODATA service and show it in table format.

i am trying this for couple of days but for some reason which I am not able identify the data is not getting reflected in the frontend.

i am using eclipse luna with ui5 plugins as IDE.

architectSAP
Active Contributor
0 Kudos

Hello Arijit,

If you are not familiar with the way SAPIU5 consumes OData services yet, I would recommend that you start with a template from the Web IDE, inspect how this works and apply this to your custom SAPUI5 app.

Best regards

Frank