Skip to Content
Feb 18, 2016 at 04:59 PM

XML View and binding path


Hello everyone

Within one single view I have a Text-element. This is to show the default customer number assigned to the logged in user in our ERP.

The data binding for it is set in the controller.

XML view:

<Text id="txtCustNo" text="{CustomerNo}"/>


var oText = oView.byId("txtCustNo");

When testing it, the value in the Text-element shows up just fine.

So there is no issue with the gateway service implementation.

So far, so good, but...

I also need to populate a table with the list of sales organizations of this default customer number. This table is defined like that in the XML view:


  noDataText="no data found" 
  <t:Column id="col1">
  <Label text="Sales organization ID"/>
  <Text text="{SalesOrgId}"/>
  <t:Column id="col2">
  <Label text="Name"/>
  <Text text=" {SalesOrgText}"/>

Now, in my OData model I have two entitysets available (CustomerSet and CustomerSalesOrgsSet) to populate this table. The implemented gateway services work fine when testing it using the SAP Gateway Client with e.g. /sap/opu/odata/sap/MYSERVICE/CustomerSet('0010074430')/CustomerSalesOrgsSet

But how to do the data binding for the table rows?

Adding a hardcoded binding path as rows attribute in aboves Table element of the XML view like that doesn't work:


Hard coding it like that in onAfterRendering event of the controller however works:

var oView = this.getView();
var oTable = oView.byId("tblCustSalesOrgs");

But how to put in the customer number (the one that came from /UserDefaults('X')/CustomerNo for the Text-element) dynamically into the binding path for my table rows?

I'd like to achieve this without any further user interaction as it is the views content that should show up initially and automatically.

Or is there a way to get the value of CustomerNo out of this /UserDefaults('X') context in the onAfterRendering event? I tried to do so but the data is not available at this point.

Thanks anyone for guiding me through this issue.

Regards, Renaud