Skip to Content
0
Jul 08, 2020 at 08:30 PM

SAPUI5 Read oData value

688 Views

Hi

I am trying to call a oData service and read the value of a field into a variable. But i am getting nothing into the variable even though i can see from the Trace that oData is returning data allright.

Code:

            var oGeneralModel = this.getOwnerComponent().getModel("GeneralModel");
            oGeneralModel.read("/GeneralDataSet('xxx')", null);  


            var username = oGeneralModel.getData("/GeneralData/Uname");

I am reading a single Entity and need the value of "GeneralData->Uname" into variable "username"

What is wrong?