on 05-23-2017 6:15 AM
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>
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.