Skip to Content
0
Jul 24, 2020 at 01:06 PM

SAP UI5 and Fiori Split App with Association

427 Views Last edit Jul 24, 2020 at 01:12 PM 2 rev

Hello Everyone,

I am trying to build a Master Detail Purchase order App .I am able to fetch Master PO Header details from my Odata service.I tried to create association between PO header and PO item in ODATA. When I tried to make call on SAP Netweaver Gateway it was successfull with $expand .But when I try to bind the PO item detail in my SAP UI5 front end data it is not binding properly .I am able to navigate to my detail view with selected header PO id which I could see in URL end point but only data in SAP.UI.TABLE is not binding properly.

Below is the actual code with screenshots:

My detail view(View2.controller.js) code

sap.ui.define([
	"sap/ui/core/mvc/Controller"
], function (Controller) {
	"use strict";


	return Controller.extend("app.po.ZfioPo.controller.View2", {


		/**
		 * Called when a controller is instantiated and its View controls (if available) are already created.
		 * Can be used to modify the View before it is displayed, to bind event handlers and do other one-time initialization.
		 * @memberOf app.po.ZfioPo.view.View2
		 */
		onInit: function () {
			this.oRouter = this.getOwnerComponent().getRouter();
			this.oRouter.attachRoutePatternMatched(this.load, this);
		},
		load: function (oEvent) {
			var id = oEvent.getParameter("arguments").poid; /*/ProductSet('id')*/
			var sPath = "/" + id; /*address of the fruit which was selected */
			var oTable = this.getView().byId("idTab");
			oTable.bindElement({
				path: sPath,
				parameters: {
					expand: "ToItem"
				}
			});
		}
	});
});

My View2.xml code:-> As of now I just try to print Item nos in table

<mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" controllerName="app.po.ZfioPo.controller.View2"
	xmlns:table="sap.ui.table">
	<Page title="Title">
		<content>
			<!--<ObjectHeader id="wow" title="{Ebeln}" intro="{Bukrs}">-->
			<!--	<attributes>-->
			<!--		<ObjectAttribute title="Documenttype" text="{Bstyp}"></ObjectAttribute>-->
			<!--		<ObjectAttribute title="Category" text="{Bsart}"></ObjectAttribute>-->
			<!--	</attributes>-->
			<!--</ObjectHeader>-->
			<table:Table id="idTab" selectionMode="Single" visibleRowCount="3">
				<table:columns>
					<table:Column>
						<table:label>
							<Label text="PO number"></Label>
						</table:label>
						<table:template>
							<Text text="{ToItem/Ebelp}"></Text>
						</table:template>
					</table:Column>
					<table:Column>
						<table:label>
							<Label text="PO number"></Label>
						</table:label>
						<table:template>
							<Text text="{ToItem/Ebelp}"></Text>
						</table:template>
					</table:Column>
				</table:columns>
			</table:Table>
		</content>
	</Page>
</mvc:View>

Output,Metadata,$expand call are kept in attachment.

2020-07-24-18h27-24.png2020-07-24-18h31-18.pngI know for sure I am missing something on my detail view and controller .It will be really helpful If i could I know soultion for my problem.

Thanks in Advance!!

Have a Great Day!!