Technical Articles
How to add annotations to an OData service without using code
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.
Hi, thanks for this great blog.
I also use this Annotation-Feature in the Service-Builder, but one thing is missing: Where can I define the Qualifiers for some Annotations, e.g. "FieldGroup"?
In the Annotation-Modeler of the Web-IDE is it maintenable:
Hi . Thanks for the Compliment
We can define Field Group in com.sap.vocabularies.UI.v1
Hi Christian Kloy,
can please share the details of How to add annotations in ui5 webIDE..
Hi Christian Kloy,
can you please share the details of how you add annotations in Ui5 webIDE..
nice. Thanks for Sharing Urvashi Tibrewal !
Thank You
Hi Urvashi Tibrewal
Thanks for sharing. If it is possible, do u have any idea for my question? https://answers.sap.com/questions/13107727/annotation-segw-travel-request-v2.html
Thanks.
Hello Urvashi Tibrewal
In my SEGW transaction I don't have this button "Annotations". Do you know what I need to setup or customize to add this button?
Annotations
Hello Yury,
I have the same problem, I am not able to see the Annotations button.
Did you manage to find the answer?
Regards,
Arul.
When you are creating the project please select Service with Vocabulary based Annotation as Project type
Even though I can see the Annotations button, but it's gray. I can do nothing about it.
Solved, by doing one step: