Skip to Content
avatar image
Former Member

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

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>

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    May 23, 2017 at 06:57 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • 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

  • May 23, 2017 at 06:50 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • 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

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

    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

    Add comment
    10|10000 characters needed characters exceeded