-1
adminloginButton: function (oEvent) {
    var model1 = new sap.ui.model.odata.ODataModel("TEST");
    sap.ui.getCore().setModel(model1);

    model1.read("/admin(ADMINID,ADMINNAME,ADMINPASSWORD)", {
        success: function (oData, oResponse) {
        },
        error: function (err) {
        }
    });
}

Here what to write in the success function to read a particular row from the table admin having three columns ADMINID,ADMINNAME & ADMINPASSWORD (ALL THREE ARE KEYS) and then to message toast the values in rows.

fhnaseer
  • 7,159
  • 16
  • 60
  • 112
96rashijain
  • 79
  • 2
  • 15
  • 1
    When adding keys (especially when there are multiple of them), please use the API `ODataModel.createKey`: https://stackoverflow.com/a/47016070/5846045 – Boghyon Hoffmann Feb 22 '19 at 14:20
  • If the app is Component based, avoid setting models on the Core: https://stackoverflow.com/a/42251431/5846045 – Boghyon Hoffmann Feb 22 '19 at 14:21
  • `sap.ui.mode.odata.ODataModel` is deprecated. See _[Stop using sap.ui.model.odata.ODataModel aka V1 ODataModel – it’s deprecated since 2015!](https://blogs.sap.com/2017/02/03/stop-using-sap.ui.model.odata.odatamodel-aka-v1-odatamodel-its-deprecated-since-2014/)_ – Boghyon Hoffmann Feb 22 '19 at 14:23
  • You might want to use `.createBindingContext` (instead of `.read`) which provides APIs to access the "particular row" or field. E.g. https://stackoverflow.com/a/54554635/5846045 – Boghyon Hoffmann Feb 22 '19 at 14:29

1 Answers1

0

If you use oData from sap Netweaver (what i think you want to do) and you have implemented the method for GET_ENTITY returning the structure than contain the row with your ids than you must simply use MessageToast.show(oData.SPECIFIC_COLUMN)

I hope it helps.

S. Florin
  • 375
  • 3
  • 15