Skip to Content

OVP Search - How to apply filter for multiple cards using different models and types

Hi all,

Scenario:

I have an custom overview page app showing information about cost center, cost elements, cost center groups and cost element groups.

All my backend logic was done using CDS views in HANA and exposing them as oData services (so no SEGW not SADL are involved). As I have four cards in the OVP app, I created four separate CDS views. As a matter of fact, I have a bunch of other auxiliar views which are used by the main four.

I am using all annotations locally in the UI5 project and not in the CDS views directly.

Now I have to add some search fiels in the OVP and apply them to all cards.

My issues:

As I have 4 oData services, I created 4 models inside my manifest and each card uses one of them. But then what should I do in the globalFilterModel and globalFilterEntityType attributes inside manifest.json as I have 4 models and 4 different entity types?

The only page about search in the docs is this one

https://sapui5.hana.ondemand.com/#/topic/73d96937ae94468da04cf0d32eb4c6ee

"sap.ovp": {
		"globalFilterModel": "CostCentersVariance",
		"globalFilterEntityType": "Y02FCO_CCA_OVP_1Type",

I am not sure what annotations to use (and where) in order to:

Add search fields in the search bar which are valid for all cards

Link them to input parameters in my views

manifest.json

{
	"_version": "1.6.0",
	"start_url": "start.html",
	"sap.app": {
		"id": "xxx.costcenter.ovp",
		"type": "application",
		"title": "{{app_title}}",
		"description": "{{app_description}}",
		"i18n": "i18n/i18n.properties",
		"applicationVersion": {
			"version": "${project.version}"
		},
		"resources": "resources.json",
		"dataSources": {
			"Y02FCO_CCA_OVP_1_CDS": {
				"uri": "/sap/opu/odata/sap/Y02FCO_CCA_OVP_1_CDS/",
				"type": "OData",
				"settings": {
					"localUri": "localService/Y02FCO_CCA_OVP_1_CDS/metadata.xml",
					"annotations": [
						"Y02FCO_CCA_OVP_1_CDS_VAN"
					]
				}
			},
			"Y02FCO_CCA_OVP_1_CDS_VAN": {
				"uri": "annotations/Y02FCO_CCA_OVP_1_CDS.xml",
				"type": "ODataAnnotation",
				"settings": {
					"localUri": "annotations/Y02FCO_CCA_OVP_1_CDS.xml"
				}
			},
			"Y02FCO_CCA_OVP_2_CDS": {
				"uri": "/sap/opu/odata/sap/Y02FCO_CCA_OVP_2_CDS/",
				"type": "OData",
				"settings": {
					"localUri": "localService/Y02FCO_CCA_OVP_2_CDS/metadata.xml",
					"annotations": [
						"Y02FCO_CCA_OVP_2_CDS_VAN"
					]
				}
			},
			"Y02FCO_CCA_OVP_2_CDS_VAN": {
				"uri": "annotations/Y02FCO_CCA_OVP_2_CDS.xml",
				"type": "ODataAnnotation",
				"settings": {
					"localUri": "annotations/Y02FCO_CCA_OVP_2_CDS.xml"
				}
			},
			"Y02FCO_CCA_OVP_3_CDS": {
				"uri": "/sap/opu/odata/sap/Y02FCO_CCA_OVP_3_CDS/",
				"type": "OData",
				"settings": {
					"localUri": "localService/Y02FCO_CCA_OVP_3_CDS/metadata.xml",
					"annotations": [
						"Y02FCO_CCA_OVP_3_CDS_VAN"
					]
				}
			},
			"Y02FCO_CCA_OVP_3_CDS_VAN": {
				"uri": "annotations/Y02FCO_CCA_OVP_3_CDS.xml",
				"type": "ODataAnnotation",
				"settings": {
					"localUri": "annotations/Y02FCO_CCA_OVP_3_CDS.xml"
				}
			},
			"Y02FCO_CCA_OVP_4_CDS": {
				"uri": "/sap/opu/odata/sap/Y02FCO_CCA_OVP_4_CDS/",
				"type": "OData",
				"settings": {
					"localUri": "localService/Y02FCO_CCA_OVP_4_CDS/metadata.xml",
					"annotations": [
						"Y02FCO_CCA_OVP_4_CDS_VAN"
					]
				}
			},
			"Y02FCO_CCA_OVP_4_CDS_VAN": {
				"uri": "annotations/Y02FCO_CCA_OVP_4_CDS.xml",
				"type": "ODataAnnotation",
				"settings": {
					"localUri": "annotations/Y02FCO_CCA_OVP_4_CDS.xml"
				}
			}
		}
	},
	"sap.ui": {
		"technology": "UI5"
	},
	"sap.ui5": {
		"dependencies": {
			"minUI5Version": "${sap.ui5.dist.version}",
			"libs": {
				"sap.m": {},
				"sap.ovp": {},
				"sap.ui.core": {},
				"sap.ui.layout": {},
				"sap.ushell": {}
			}
		},
		"models": {
			"i18n": {
				"type": "sap.ui.model.resource.ResourceModel",
				"uri": "i18n/i18n.properties"
			},
			"@i18n": {
				"type": "sap.ui.model.resource.ResourceModel",
				"uri": "i18n/i18n.properties"
			},
			"CostCentersVariance": {
				"dataSource": "Y02FCO_CCA_OVP_1_CDS",
				"settings": {
					"useBatch": false
				}
			},
			"ExpenseTypes": {
				"dataSource": "Y02FCO_CCA_OVP_2_CDS",
				"settings": {
					"useBatch": false
				}
			},
			"YearComparisonChart": {
				"dataSource": "Y02FCO_CCA_OVP_4_CDS",
				"settings": {
					"useBatch": false
				}
			},
			"ExpenseChart": {
				"dataSource": "Y02FCO_CCA_OVP_3_CDS",
				"settings": {
					"useBatch": false
				}
			}
		},
		"extends": {
			"extensions": {}
		},
		"contentDensities": {
			"compact": true,
			"cozy": true
		}
	},
	"sap.ovp": {
		"globalFilterModel": "CostCentersVariance",
		"globalFilterEntityType": "Y02FCO_CCA_OVP_1Type",
		"enableLiveFilter": true,
		"considerAnalyticalParameters": false,
		"cards": {
			"card01": {
				"model": "CostCentersVariance",
				"template": "sap.ovp.cards.list",
				"settings": {
					"category": "{{card01_category}}",
					"title": "{{card01_title}}",
					"subTitle": "{{card01_subtitle}}",
					"entitySet": "Y02FCO_CCA_OVP_1",
					"listType": "condensed",
					"listFlavor": "bar",
					"addODataSelect": false,
					"sortBy": "variance",
					"sortOrder": "descending",
					"annotationPath": "com.sap.vocabularies.UI.v1.LineItem#q1"
				}
			},
			"card02": {
				"model": "ExpenseTypes",
				"template": "sap.ovp.cards.list",
				"settings": {
					"category": "{{card02_category}}",
					"title": "{{card02_title}}",
					"subTitle": "{{card02_subtitle}}",
					"entitySet": "Y02FCO_CCA_OVP_2",
					"listType": "condensed",
					"listFlavor": "bar",
					"addODataSelect": false,
					"sortBy": "variance",
					"sortOrder": "descending",
					"annotationPath": "com.sap.vocabularies.UI.v1.LineItem#q2"
				}
			},
			"card03": {
				"model": "ExpenseChart",
				"template": "sap.ovp.cards.charts.analytical",
				"settings": {
					"category": "{{card03_category}}",
					"title": "{{card03_title}}",
					"entitySet": "Y02FCO_CCA_OVP_3",
					"chartAnnotationPath": "com.sap.vocabularies.UI.v1.Chart#c3",
					"dataPointAnnotationPath": "com.sap.vocabularies.UI.v1.DataPoint#dp3",
					"presentationAnnotationPath": "com.sap.vocabularies.UI.v1.PresentationVariant#pv3"
				}
			},
			"card04": {
				"model": "YearComparisonChart",
				"template": "sap.ovp.cards.charts.analytical",
				"settings": {
					"category": "{{card04_category}}",
					"title": "{{card04_title}}",
					"entitySet": "Y02FCO_CCA_OVP_4",
					"chartAnnotationPath": "com.sap.vocabularies.UI.v1.Chart#q4",
					"dataPointAnnotationPath": "com.sap.vocabularies.UI.v1.DataPoint#q4"
				}
			}
		}
	},
	"sap.platform.abap": {
		"uri": "/sap/bc/ui5_ui5/sap/zfco_cca_ovp/webapp",
		"_version": "1.1.0"
	}
}



Example of two CDS view

@AbapCatalog.sqlViewName: 'Y02FCO_OVP_1'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Postings Cards'
@OData: {
    publish: true
}


define view Y02FCO_CCA_OVP_1 

// commented while I am figuring out how to add search filter in the OVP
//  with parameters
//    @Consumption: {
//      defaultValue: 'F001'
//    }
//    p_controlling_area:kokrs,
//    @Consumption: {
//      defaultValue: '2017'
//    }
//    p_fiscal_year:gjahr,
//    @Consumption: {
//      defaultValue: '1'
//    }
//    p_quarter:int1,
//    @Consumption: {
//      defaultValue: '000'
//    }
    // p_version:versn
    
as select from Y02FCO_CCA_OVP_VARIANCE


    ( 
//        p_fiscal_year: $parameters.p_fiscal_year , 
//        p_quarter: $parameters.p_quarter, 
//        p_version: $parameters.p_version
//        p_fiscal_year: '2017' , 
//        p_quarter: 1, 
        p_version: '000'
    ) 
    
{
    
    key controlling_area,
    key cost_center,
    description as description,


    previous_year, 
    planned,
    
    actual, 
    variance, 
    previous_year_variance 
} 

=============


@AbapCatalog.sqlViewName: 'Y02FCO_OVP_2'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Card 2'
@OData: {
    publish: true
}
define view Y02FCO_CCA_OVP_2 


as select from Y02FCO_CCA_OVP_VARIANCE_ET( p_version: '000' )


{
     
    key expense_type, 
    name, 
    
    previous_year, 
    planned, 
    actual, 
    
    variance, 
    previous_year_variance


}



Annotations for the 1st view

<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
	<edmx:Reference xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"
		Uri="https://webide-a8706642f.dispatcher.hana.ondemand.com/destinations/I06_BASIC/sap/opu/odata/sap/Y02FCO_CCA_OVP_1_CDS/$metadata">
		<edmx:Include xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Namespace="Y02FCO_CCA_OVP_1_CDS"/>
	</edmx:Reference>
	<edmx:Reference Uri="http://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/cs02/vocabularies/Org.OData.Aggregation.V1.xml">
		<edmx:Include Alias="Aggregation" Namespace="Org.OData.Aggregation.V1"/>
	</edmx:Reference>
	<edmx:Reference Uri="http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/vocabularies/Org.OData.Capabilities.V1.xml">
		<edmx:Include Alias="Capabilities" Namespace="Org.OData.Capabilities.V1"/>
	</edmx:Reference>
	<edmx:Reference Uri="https://wiki.scn.sap.com/wiki/download/attachments/448470974/Common.xml?api=v2">
		<edmx:Include Alias="Common" Namespace="com.sap.vocabularies.Common.v1"/>
	</edmx:Reference>
	<edmx:Reference Uri="https://wiki.scn.sap.com/wiki/download/attachments/448470971/Communication.xml?api=v2">
		<edmx:Include Alias="vCard" Namespace="com.sap.vocabularies.Communication.v1"/>
	</edmx:Reference>
	<edmx:Reference Uri="http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/vocabularies/Org.OData.Core.V1.xml">
		<edmx:Include Alias="Core" Namespace="Org.OData.Core.V1"/>
	</edmx:Reference>
	<edmx:Reference Uri="http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/vocabularies/Org.OData.Measures.V1.xml">
		<edmx:Include Alias="CQP" Namespace="Org.OData.Measures.V1"/>
	</edmx:Reference>
	<edmx:Reference Uri="https://wiki.scn.sap.com/wiki/download/attachments/448470968/UI.xml?api=v2">
		<edmx:Include Alias="UI" Namespace="com.sap.vocabularies.UI.v1"/>
	</edmx:Reference>
	<edmx:DataServices>
		<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm">
			<Annotations Target="Y02FCO_CCA_OVP_1_CDS.Y02FCO_CCA_OVP_1Type">
				<Annotation Term="UI.DataPoint" Qualifier="dp2">
					<Record Type="UI.DataPointType">
						<PropertyValue Property="Title" String="previous year var"/>
						<PropertyValue Property="Value" Path="previous_year_variance"/>
					</Record>
				</Annotation>
				<Annotation Term="UI.DataPoint" Qualifier="dp1">
					<Record Type="UI.DataPointType">
						<PropertyValue Property="Title" String="variance"/>
						<PropertyValue Property="Value" Path="variance"/>
						<PropertyValue Property="CriticalityCalculation">
							<Record Type="UI.CriticalityCalculationType">
								<PropertyValue Property="ImprovementDirection" EnumMember="UI.ImprovementDirectionType/Minimize"/>
								<PropertyValue Property="ToleranceRangeLowValue" Int="0"/>
								<PropertyValue Property="ToleranceRangeHighValue" Int="0"/>
								<PropertyValue Property="AcceptanceRangeHighValue" Int="0"/>
								<PropertyValue Property="AcceptanceRangeLowValue" Int="100"/>
								<PropertyValue Property="DeviationRangeHighValue" Int="80"/>
							</Record>
						</PropertyValue>
					</Record>
				</Annotation>
				<Annotation Term="UI.LineItem" Qualifier="q1">
					<Collection>
						<Record Type="UI.DataField">
							<PropertyValue Property="Value" Path="cost_center"/>
						</Record>
						<Record Type="UI.DataField">
							<PropertyValue Property="Value" Path="description"/>
						</Record>
						<Record Type="UI.DataFieldForAnnotation">
							<PropertyValue Property="Label" String="variance"/>
							<PropertyValue Property="Target" AnnotationPath="@UI.DataPoint#dp1"/>
						</Record>
						<Record Type="UI.DataFieldForAnnotation">
							<PropertyValue Property="Target" AnnotationPath="@UI.DataPoint#dp2"/>
							<PropertyValue Property="Label" String="previous year var"/>
						</Record>
						<Record Type="UI.DataFieldForIntentBasedNavigation">
							<PropertyValue Property="SemanticObject" String="CostCenter"></PropertyValue>
							<PropertyValue Property="Action" String="track"/>
						</Record>
					</Collection>
				</Annotation>
			</Annotations>
			<Annotations Target="Y02FCO_CCA_OVP_1_CDS.Y02FCO_CCA_OVP_1Type/cost_center"/>
			<Annotations Target="Y02FCO_CCA_OVP_1_CDS.Y02FCO_CCA_OVP_1Type/description"/>
			<Annotations Target="Y02FCO_CCA_OVP_1_CDS.Y02FCO_CCA_OVP_1Type/variance">
				<Annotation Term="CQP.Unit" String="% BUD"/>
			</Annotations>
			<Annotations Target="Y02FCO_CCA_OVP_1_CDS.Y02FCO_CCA_OVP_1Type/previous_year_variance">
				<Annotation Term="CQP.Unit" String="% PY"/>
			</Annotations>
		</Schema>
	</edmx:DataServices>
</edmx:Edmx>
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jan 03 at 02:11 PM

    Have you tried the great working example at https://github.com/jasper07/Teched17 ?

    Add comment
    10|10000 characters needed characters exceeded