In this post I will showcase some of the features controlled by OData annotations. With the use of annotations in OData, we can minimize the UI View code to be written for conventional scenarios like showing text and filtering data.
Example 1: Showing search help for Filter in Personalization Dialog
Example 2: Showing Text
Example 1
The p13n dialog control provides a dialog for tables that allows the user to personalize one or more of the following attributes:
- Columns
- Sort
- Filter
- Group
The third tab is the Filter tab, which allows the user to filter based on specific criteria.
The filter criteria can be included or excluded in the relevant section of the filter.
The user selects the column to be filtered. Any of the columns can be selected from the dropdown.
The second field offers an operator for specifying the filter in more detail. The operators that are available depends on the data type of the selected column.
Scenario
Created OData ‘ZTEST_SEARCHHElP’
Main Entity: Customer
Value Help Entity: Customer Value Help
Click on Annotation at properties
Click on com.sap.vocabularies.Common.v1
Click on ValueList-> Create Annotation
Pass the ValueHelp Entity in label and ValueHelp Entityset in CollectionPath
In Parameters
For ValuelistParameterInOut
For ValueListParameterDisplay
In DPC_EXT we need to implement the CustomerValueHelp entityset to fetch the value
2> Text name
We need to Click on Annotation->com.sap.vocabularies.Common.v1->Text
Create Annotation and pass the name of the customer
The value will be displayed as below.