Skip to Content
0

SAP UI5 Smart Table with type = "AnalyticalTable" Binding Issue

May 22, 2017 at 11:02 AM

145

avatar image

Hello Experts,

I need to design an UI5 application by using Analytical Table because we need ALV features like Export, Grouping, Total, Sub Total, Sorting etc.

I've already designed a SmartTable and the corresponding OData-Service (with vocab-based annotations). Since I have the requirement to have more than one field for grouping, i've changed the tableType from ResponsiveTable to AnalyticalTable and provided the appropriate annotations like "sap:semantic = "aggregate" etc. (have a look at the metadata provided).

My problem is the following: I receive data from backend (debugged it with F12) but the data doesn't get displayed in the table. I've already checked, if there are duplicate keys or keys have invalid input but i didn't get it.

I hope someone finds a bug and provides his suggestions to fix this issue.

Thanks and best regards,

Mike

View:

<core:View controllerName="ch.direct.servicebroker.view.Master" xmlns:core="sap.ui.core" xmlns:l="sap.ui.layout"
	xmlns:smartTable="sap.ui.comp.smarttable" xmlns:smartFilterBar="sap.ui.comp.smartfilterbar" xmlns:table="sap.ui.table" xmlns="sap.m">
	<Page navButtonPress="onNavBack" title="{i18n>masterTitle}">
		<content>
			<VBox width="auto">
				<smartTable:SmartTable id="idLeistungenTable" tableType="AnalyticalTable" initialise="onSmartTableInit" editable="false"
					useVariantManagement="true" useTablePersonalisation="true" persistencyKey="SmartTablePers" header="Leistungen" showRowCount="true"
					useExportToExcel="true" enableAutoBinding="false" entitySet="LeistungCollection" editToggled="onEditToggled"
					beforeRebindTable="beforeRebindTable" dataReceived="dataReceived" afterVariantInitialise="afterVariantInit"
					afterVariantSave="afterVariantsave" afterVariantApply="afterVariantApply" showOverlay="showOverlay" fieldChange="fieldChange"/>
			</VBox>
		</content>
	</Page>
</core:View>

Controller:

	_bindTable: function(aFilters) {


		this._aSelection = aFilters;


		var oSmartTable = this.byId("idLeistungenTable");
		oSmartTable.setModel(this.getView().getModel());
		//var oTable = oSmartTable.getTable();


		//oTable.setGrowingThreshold(10000);


		oSmartTable.rebindTable();


	},

Metadata:

<?xml version="1.0" encoding="utf-8" ?>
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"
	xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:sap="http://www.sap.com/Protocols/SAPData">
	<edmx:Reference
		Uri="https://sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Vocabularies(TechnicalName='%2FIWBEP%2FVOC_UI',Version='0001',SAP__Origin='MT3CL501')/$value"
		xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"><edmx:Include Namespace="com.sap.vocabularies.UI.v1"/></edmx:Reference>
	<edmx:Reference
		Uri="https://sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Vocabularies(TechnicalName='%2FIWBEP%2FVOC_CORE',Version='0001',SAP__Origin='MT3CL501')/$value"
		xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"><edmx:Include Namespace="Org.OData.Core.V1"/></edmx:Reference>
	<edmx:Reference
		Uri="https://sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Vocabularies(TechnicalName='%2FIWBEP%2FVOC_COMMUNICATION',Version='0001',SAP__Origin='MT3CL501')/$value"
		xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"><edmx:Include Namespace="com.sap.vocabularies.Communication.v1"/></edmx:Reference>
	<edmx:Reference
		Uri="https://sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Vocabularies(TechnicalName='%2FIWBEP%2FVOC_COMMON',Version='0001',SAP__Origin='MT3CL501')/$value"
		xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"><edmx:Include Namespace="com.sap.vocabularies.Common.v1"/></edmx:Reference>
	<edmx:DataServices m:DataServiceVersion="2.0">
		<Schema Namespace="ZVO_SERVICE_BROKER_UI5_SRV_01" xml:lang="de" sap:schema-version="1" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
			<EntityType Name="Leistung" sap:semantics="aggregate" sap:content-version="1">
				<Key><PropertyRef Name="ZZ_O1_L_VERMITTL"/><PropertyRef Name="ZZ_O1_L_KNL_CODE"/><PropertyRef Name="ZZ_O1_L_VP_DIDOK"/><PropertyRef Name="ZZ_O1_TL_PRODNR"/><PropertyRef Name="ZZ_O1_TL_E_TYP"/></Key><Property Name="ZZ_O1_L_VERMITTL" Type="Edm.String" Nullable="false" MaxLength="5" sap:aggregation-role="dimension" sap:creatable="false"
					sap:filterable="true" sap:sortable="true" sap:updatable="false" sap:label="LeistungsVermittler"/><Property Name="VERMITTL_NAME" Type="Edm.String" MaxLength="40" sap:aggregation-role="dimension" sap:creatable="false" sap:filterable="true"
					sap:sortable="true" sap:updatable="false" sap:label="LeistungsVermittler"/><Property Name="ZZ_O1_L_KNL_CODE" Type="Edm.String" Nullable="false" MaxLength="10" sap:aggregation-role="dimension" sap:creatable="false"
					sap:filterable="true" sap:sortable="true" sap:updatable="false" sap:label="Kanal-Code"/><Property Name="KNL_BEZEICHNUNG" Type="Edm.String" MaxLength="100" sap:aggregation-role="dimension" sap:creatable="false"
					sap:filterable="true" sap:sortable="true" sap:updatable="false" sap:label="Bezeichung Kanal"/><Property Name="ZZ_O1_L_VP_DIDOK" Type="Edm.String" Nullable="false" MaxLength="5" sap:aggregation-role="dimension" sap:creatable="false"
					sap:filterable="true" sap:sortable="true" sap:updatable="false" sap:label="Vert.Punkt Didok"/><Property Name="DIDOK_BEZEICHNUNG" Type="Edm.String" MaxLength="100" sap:aggregation-role="dimension" sap:creatable="false"
					sap:filterable="true" sap:sortable="true" sap:updatable="false" sap:label="Bezeichnung DIDOK"/><Property Name="ZZ_O1_TL_PRODNR" Type="Edm.String" Nullable="false" MaxLength="7" sap:aggregation-role="dimension" sap:creatable="false"
					sap:filterable="true" sap:sortable="true" sap:updatable="false" sap:label="Produktnummer"/><Property Name="PROD_BEZ" Type="Edm.String" MaxLength="100" sap:aggregation-role="dimension" sap:creatable="false" sap:filterable="true"
					sap:sortable="true" sap:updatable="false" sap:label="Produktbezeichnung"/><Property Name="ANZAHL" Type="Edm.Int32" sap:aggregation-role="dimension" sap:creatable="false" sap:filterable="true" sap:sortable="true"
					sap:updatable="false" sap:label="Anzahl Leistungen"/><Property Name="UMSATZ" Type="Edm.Decimal" Precision="13" Scale="2" sap:aggregation-role="dimension" sap:creatable="false"
					sap:filterable="true" sap:sortable="true" sap:updatable="false" sap:label="Umsatz"/><Property Name="WAEHRUNG" Type="Edm.String" MaxLength="5" sap:aggregation-role="dimension" sap:creatable="false" sap:filterable="true"
					sap:sortable="true" sap:updatable="false" sap:label="Währung" sap:semantics="currency-code"/><Property Name="ZZ_O1_TL_E_TYP" Type="Edm.String" Nullable="false" MaxLength="2" sap:aggregation-role="dimension" sap:creatable="false"
					sap:filterable="true" sap:sortable="true" sap:updatable="false" sap:label="Erstattungstyp"/><Property Name="E_TYP_BEZ" Type="Edm.String" MaxLength="100" sap:aggregation-role="dimension" sap:creatable="false" sap:filterable="true"
					sap:sortable="true" sap:updatable="false" sap:label="Beschreibung"/><Property Name="PROVISIONEN" Type="Edm.Decimal" Precision="13" Scale="2" sap:aggregation-role="dimension" sap:creatable="false"
					sap:filterable="true" sap:sortable="true" sap:updatable="false" sap:label="Provisionen"/><Property Name="WAEHRUNG_PROV" Type="Edm.String" MaxLength="5" sap:aggregation-role="dimension" sap:creatable="false" sap:filterable="true"
					sap:sortable="true" sap:updatable="false" sap:label="Währung" sap:semantics="currency-code"/><Property Name="VERKAUFSDATUM" Type="Edm.DateTime" Precision="7" sap:aggregation-role="dimension" sap:creatable="false"
					sap:filterable="true" sap:sortable="true" sap:updatable="false" sap:label="Verkaufsdatum"/></EntityType>
			<EntityContainer Name="ZVO_SERVICE_BROKER_UI5_SRV_01_Entities" m:IsDefaultEntityContainer="true" sap:supported-formats="atom json xlsx"><EntitySet Name="LeistungCollection" EntityType="ZVO_SERVICE_BROKER_UI5_SRV_01.Leistung" sap:content-version="1"/></EntityContainer>
			<Annotations Target="ZVO_SERVICE_BROKER_UI5_SRV_01.Leistung/ZZ_O1_L_VERMITTL" xmlns="http://docs.oasis-open.org/odata/ns/edm"><Annotation Term="com.sap.vocabularies.Common.v1.SemanticObject" String="SemanticObjectLVermittl"/></Annotations>
			<Annotations Target="ZVO_SERVICE_BROKER_UI5_SRV_01.Leistung/VERMITTL_NAME" xmlns="http://docs.oasis-open.org/odata/ns/edm"><Annotation Term="com.sap.vocabularies.Common.v1.SemanticObject" String="SemanticObjectName"/></Annotations>
			<Annotations Target="ZVO_SERVICE_BROKER_UI5_SRV_01.Leistung/ZZ_O1_L_KNL_CODE" xmlns="http://docs.oasis-open.org/odata/ns/edm"><Annotation Term="com.sap.vocabularies.Common.v1.SemanticObject" String="SemanticObjectKnlCode"/></Annotations>
			<Annotations Target="ZVO_SERVICE_BROKER_UI5_SRV_01.Leistung/KNL_BEZEICHNUNG" xmlns="http://docs.oasis-open.org/odata/ns/edm"><Annotation Term="com.sap.vocabularies.Common.v1.SemanticObject" String="SemanticObjectKnlBezeichnung"/></Annotations>
			<Annotations Target="ZVO_SERVICE_BROKER_UI5_SRV_01.Leistung/ZZ_O1_L_VP_DIDOK" xmlns="http://docs.oasis-open.org/odata/ns/edm"><Annotation Term="com.sap.vocabularies.Common.v1.SemanticObject" String="SemanticObjectDidok"/></Annotations>
			<Annotations Target="ZVO_SERVICE_BROKER_UI5_SRV_01.Leistung/DIDOK_BEZEICHNUNG" xmlns="http://docs.oasis-open.org/odata/ns/edm"><Annotation Term="com.sap.vocabularies.Common.v1.SemanticObject" String="SemanticObjectDidokBezeichnung"/></Annotations>
			<Annotations Target="ZVO_SERVICE_BROKER_UI5_SRV_01.Leistung/ZZ_O1_TL_PRODNR" xmlns="http://docs.oasis-open.org/odata/ns/edm"><Annotation Term="com.sap.vocabularies.Common.v1.SemanticObject" String="SemanticObjectTlProdnr"/></Annotations>
			<Annotations Target="ZVO_SERVICE_BROKER_UI5_SRV_01.Leistung/PROD_BEZ" xmlns="http://docs.oasis-open.org/odata/ns/edm"><Annotation Term="com.sap.vocabularies.Common.v1.SemanticObject" String="SemanticObjectProdBez"/></Annotations>
			<Annotations Target="ZVO_SERVICE_BROKER_UI5_SRV_01.Leistung/ANZAHL" xmlns="http://docs.oasis-open.org/odata/ns/edm"><Annotation Term="com.sap.vocabularies.Common.v1.SemanticObject" String="SemanticObjectAnzahl"/></Annotations>
			<Annotations Target="ZVO_SERVICE_BROKER_UI5_SRV_01.Leistung/UMSATZ" xmlns="http://docs.oasis-open.org/odata/ns/edm"><Annotation Term="com.sap.vocabularies.Common.v1.SemanticObject" String="SemanticObjectName"/></Annotations>
			<Annotations Target="ZVO_SERVICE_BROKER_UI5_SRV_01.Leistung/WAEHRUNG" xmlns="http://docs.oasis-open.org/odata/ns/edm"><Annotation Term="com.sap.vocabularies.Common.v1.SemanticObject" String="SemanticObjectWaehrung"/></Annotations>
			<Annotations Target="ZVO_SERVICE_BROKER_UI5_SRV_01.Leistung/ZZ_O1_TL_E_TYP" xmlns="http://docs.oasis-open.org/odata/ns/edm"><Annotation Term="com.sap.vocabularies.Common.v1.SemanticObject" String="SemanticObjectTlETyp"/></Annotations>
			<Annotations Target="ZVO_SERVICE_BROKER_UI5_SRV_01.Leistung/E_TYP_BEZ" xmlns="http://docs.oasis-open.org/odata/ns/edm"><Annotation Term="com.sap.vocabularies.Common.v1.SemanticObject" String="SemanticObjectETypBez"/></Annotations>
			<Annotations Target="ZVO_SERVICE_BROKER_UI5_SRV_01.Leistung/PROVISIONEN" xmlns="http://docs.oasis-open.org/odata/ns/edm"><Annotation Term="com.sap.vocabularies.Common.v1.SemanticObject" String="SemanticObjectProvisionen"/></Annotations>
			<Annotations Target="ZVO_SERVICE_BROKER_UI5_SRV_01.Leistung/WAEHRUNG_PROV" xmlns="http://docs.oasis-open.org/odata/ns/edm"><Annotation Term="com.sap.vocabularies.Common.v1.SemanticObject" String="SemanticObjectWaehrungProv"/></Annotations>
			<Annotations Target="ZVO_SERVICE_BROKER_UI5_SRV_01.Leistung/VERKAUFSDATUM" xmlns="http://docs.oasis-open.org/odata/ns/edm"><Annotation Term="com.sap.vocabularies.Common.v1.SemanticObject" String="SemanticObjectVDatum"/></Annotations>
			<Annotations Target="ZVO_SERVICE_BROKER_UI5_SRV_01.Leistung" xmlns="http://docs.oasis-open.org/odata/ns/edm">
				<Annotation Term="com.sap.vocabularies.UI.v1.LineItem">
					<Collection>
						<Record Type="com.sap.vocabularies.UI.v1.DataField"><PropertyValue Property="Label" String="LeistungsVermittler"/><PropertyValue Property="Value" Path="ZZ_O1_L_VERMITTL"/></Record>
						<Record Type="com.sap.vocabularies.UI.v1.DataField"><PropertyValue Property="Label" String="LeistungsVermittler"/><PropertyValue Property="Value" Path="VERMITTL_NAME"/></Record>
						<Record Type="com.sap.vocabularies.UI.v1.DataField"><PropertyValue Property="Label" String="Kanal-Code"/><PropertyValue Property="Value" Path="ZZ_O1_L_KNL_CODE"/></Record>
						<Record Type="com.sap.vocabularies.UI.v1.DataField"><PropertyValue Property="Label" String="Bezeichung Kanal"/><PropertyValue Property="Value" Path="KNL_BEZEICHNUNG"/></Record>
						<Record Type="com.sap.vocabularies.UI.v1.DataField"><PropertyValue Property="Label" String="Verkaufsstelle"/><PropertyValue Property="Value" Path="ZZ_O1_L_VP_DIDOK"/></Record>
						<Record Type="com.sap.vocabularies.UI.v1.DataField"><PropertyValue Property="Label" String="Bezeichnung DIDOK"/><PropertyValue Property="Value" Path="DIDOK_BEZEICHNUNG"/></Record>
						<Record Type="com.sap.vocabularies.UI.v1.DataField"><PropertyValue Property="Label" String="Produktnummer"/><PropertyValue Property="Value" Path="ZZ_O1_TL_PRODNR"/></Record>
						<Record Type="com.sap.vocabularies.UI.v1.DataField"><PropertyValue Property="Label" String="Produktbezeichnung"/><PropertyValue Property="Value" Path="PROD_BEZ"/></Record>
						<Record Type="com.sap.vocabularies.UI.v1.DataField"><PropertyValue Property="Label" String="Anzahl"/><PropertyValue Property="Value" Path="ANZAHL"/></Record>
						<Record Type="com.sap.vocabularies.UI.v1.DataField"><PropertyValue Property="Label" String="Umsatz"/><PropertyValue Property="Value" Path="UMSATZ"/></Record>
						<Record Type="com.sap.vocabularies.UI.v1.DataField"><PropertyValue Property="Label" String="Währung"/><PropertyValue Property="Value" Path="WAEHRUNG"/></Record>
						<Record Type="com.sap.vocabularies.UI.v1.DataField"><PropertyValue Property="Label" String="Erstattungstyp"/><PropertyValue Property="Value" Path="ZZ_O1_TL_E_TYP"/></Record>
						<Record Type="com.sap.vocabularies.UI.v1.DataField"><PropertyValue Property="Label" String="Beschreibung"/><PropertyValue Property="Value" Path="E_TYP_BEZ"/></Record>
						<Record Type="com.sap.vocabularies.UI.v1.DataField"><PropertyValue Property="Label" String="Provisionen"/><PropertyValue Property="Value" Path="PROVISIONEN"/></Record>
						<Record Type="com.sap.vocabularies.UI.v1.DataField"><PropertyValue Property="Label" String="Währung"/><PropertyValue Property="Value" Path="WAEHRUNG_PROV"/></Record>
					</Collection>
				</Annotation>
			</Annotations><atom:link rel="self" href="https://sapmt300.sbb.ch:44300/sap/opu/odata/sap/ZVO_SERVICE_BROKER_UI5_SRV_01/$metadata"
				xmlns:atom="http://www.w3.org/2005/Atom"/><atom:link rel="latest-version" href="https://sapmt300.sbb.ch:44300/sap/opu/odata/sap/ZVO_SERVICE_BROKER_UI5_SRV_01/$metadata"
				xmlns:atom="http://www.w3.org/2005/Atom"/></Schema>
	</edmx:DataServices>
</edmx:Edmx>
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Silent Monk May 22, 2017 at 12:41 PM
-1

hi,

For table data binding in UI5 view controller, code mentioned at below page can be used. Please take a look

Data Binding UI5 table

Thank you !

Silent Monk

Share
10 |10000 characters needed characters left characters exceeded
Michael Dräyer May 22, 2017 at 11:05 AM
0

Remark:

I've implemented the method "beforeRebindTable" as follow:

	beforeRebindTable: function(oEvent) {


		var oBindingParams = oEvent.getParameter("bindingParams");
		var aFilters = oBindingParams.filters;


		this._aSelection.forEach(function(filter) {
			aFilters.push(filter);
		});


	}
Share
10 |10000 characters needed characters left characters exceeded