Skip to Content
Jan 12, 2017 at 02:57 PM

SAPUI5 in HCP referencing multiple OData Sources


I've got a SAPUI5 app in HCP that I started with WebIDE's Master Detail template.

I have two OData services, both through the Hana Cloud Connector with destinations in HCP.

My primary OData service is coming through fine, and the master and detail relationship works fine. It's running off of a non-SAP legacy system with Olingo. The secondary service is our on-premise SAP system.

I am trying to have, on my detail page, one or two fields pulled from the secondary service for a matching entity.

So, if we call my primary source A, I have A(invoices), with A(invoices)->InvoiceDetails as the detail collection. I want to be able to hit the secondary OData source B for item name in the same list results as my invoice details.

I have these routes defined in neoapp.json:

"path": "/ADest", "target": {"type": "destination",
"name": "ADest" }, "description": "ASource Odata"
}, {
"path": "/BDest", "target": {
"type": "destination",
"name": "BDest"
}, "description": "BDest Odata"

My manifest.json has entries for the two sources like this:

"dataSources":{ "mainService": { "uri": "/ADest/Odata/odatapoc.svc/",
"type": "OData",
"settings": { "odataVersion": "2.0",
"localUri": "localService/metadata.xml"
} }, "otherService": {
"uri": "/BDest/sap/opu/odata/sap/another_srv/",
"type": "OData",
"settings": {
"odataVersion": "2.0"
} }


"models": { "i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "pdpgenpoc.i18n.i18n"
}, "": {
"dataSource": "mainService",
"preload": true
}, "src2": {
"dataSource": "otherService",
"type": "sap.ui.model.odata.v2.ODataModel",
"preload": true
} }

/ADest/Odata/odatapoc.svc/ has entities /Invoices, which in turn has InvoiceDetails. InvoiceDetails has a member element VendNum.

/BDest/sap/opu/odata/sap/another_srv/ has /Vendors with vendor number as key.

The xml for my detail view includes:

<Table id="lineItemsList" width="auto" items="{InvoiceDetails}" updateFinished="onListUpdateFinished" noDataText="{i18n>detailLineItemTableNoDataText}" busyIndicatorDelay="{detailView>/lineItemTableDelay}"> <headerToolbar>
<Toolbar id="lineItemsToolbar">
<Title id="lineItemsHeader" text="{detailView>/lineItemListTitle}"/>


<Column><Text text="{i18n>detailLineItemTableIDColumn}"/></Column> <Column minScreenWidth="Tablet" demandPopin="true" hAlign="Right">
<Text text="{i18n>detailLineItemTableUnitNumberColumn}"/>

<Column><Text text="3"/></Column>



<ColumnListItem type="Navigation" press="onPress">

<ObjectIdentifier title="{ItemDesc}" text="{InvcDtlNum}"/>
<ObjectNumber number="{ path: 'VendNum', formatter: '.formatter.currencyValue' }" unit="{InvcItemNum}"/>
<ObjectAttribute id="VendName" visible="true" title="{VendNum}" text="{src2>Vendors(VendNum)/VendName}" active="false"/>




I've tried a few variants on the binding {src2>Vendors(VendNum)/VendName}, including expression binding like {= src2>Vendors('VendNum')/VendName}, even trying just hard coding {src2>Vendors('12345')/VendName} to see if I could just pull a hard-coded vendor's name, but the expression isn't returning anything.

Two questions; first, is there something I've missed to be able to use src2 in my view XML? I'm not referencing it in the controller at this point.

Second, how do I reference the main service's bound element (VendNum) inside an expression pointing at the secondary service (src2)?