Skip to Content
0

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

May 23, 2017 at 05:15 AM

266

avatar image
Former Member

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>

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
VIPLOVE KHUSHALANI May 23, 2017 at 06:57 AM
0

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

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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

0

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

0
Frank Schuler
May 23, 2017 at 06:50 AM
0

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

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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.

0

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

0
avatar image
Former Member May 26, 2017 at 08:30 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded