Skip to Content

Accessing OData property value in entity


I just started doing some exercise on SAPUI5, here is my problem description:

I have an objectHeader control which i have binded with Entity_A using bindElement. However i want to bind another value from Entity_B to one of the objectHeader property. How do i do that?

I have set up my on-premise SAP odata service as data source, which verified works in binding to controls (and verified via other exercise). My Manifest.json as following:

"OData":{ "dataSource" : "D30" } --> the destination is properly set up in Hana Cloud Platform Destination setting


so far, I have tried following:

1. in view controller, getting the value from Entity_B from OData model. Something like following :

var oModel = new sap.ui.model.odata.ODataModel(""); <--full URL

var value = oModel.getProperty("OData>/EntitySet_B('ABC')/value");


2. Also tried accessing Odata model in manifest.json

var oModel = new sap.ui.model.odata.ODataModel("OData"); <-- data source predefined in manifest.json

var value = oModel.getProperty("OData>/EntitySet_B('ABC')/Value")


3. Also tried

val value ="OData>/EntitySet_B('ABC')/value", { success: function(odata,response){ ... }, error: function(error){ } });


4. I haven't tried to instantiate OData model object with "destinations/D30". Which it probably use the ready-set credential to access my Odata service

How do i use instantiate Odata model object using "destination/D30" (which contain the service URL)?

Anybody have any other idea?



Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Mar 26 at 07:30 AM


    You can simply use named models.

    You can name the models.

    Your objectHeader code will look like below:

    <ObjectHeader binding="{entityA>/ProductCollection}" title="{Name}">


    <ObjectAttribute text="{entityA>WeightMeasure} {entityA>WeightUnit}" />

    <ObjectAttribute text="{entityB>/Width} x {entityB>/Depth} x {entityB>/Height} {entityB>/DimUnit}" />



    Hope it will help,

    Best Regards,

    Rajvardhan Thakare

    Add comment
    10|10000 characters needed characters exceeded