2024 Aug 21 1:53 PM - last edited on 2024 Aug 23 5:42 PM by thomas_jung
Another Wednesday and we are back with Task 3 of the August Developer Challenge on ABAP Core Data Services. We are thrilled to see the amazing response to Task 1 and Task 2. Whoever missed it can find all the information in our blogpost August Developer Challenge.
Today for Task 3 we decided to take you all through one of the interesting and widely used feature of ABAP Core Data Services – Annotations.
Annotations allow you to add domain-specific metadata and text labels to CDS objects that goes beyond the syntax features of ABAP SQL. This means that it enhances the technical properties of CDS view entities such as adding search , capabilities or controlling access to your data. To know more about Annotations watch the SAP TechByte on Annotations or go through the CDS Annotation Help Documentation
Task 3 – In this task we will add annotations to the CDS View Entity created in Task1 and then create a Fiori app to view the results.
Follow the instructions carefully and share with us the screenshots of the items mentioned in the ‘Validation’ section of this discussion.
Please use this separate thread to ask your questions and discuss issues.
Validation :-
Note:- Please do not search with '*'
Please share screenshots after performing the following :
We are eagerly waiting to see your submissions. Enjoy!!
2024 Aug 26 1:31 PM
Hi @Shilpa_Shankar - Thanks for your feedback. Changed the filter to Status Text instead of the Status Code.
Please find the below screen shot for the same.
Regards,
Chandana.
2024 Aug 22 1:19 PM
Week Task - 3 Completed
1. Search enabled for Travel Description.
2. Value help given for status description field
2024 Aug 22 1:40 PM
Hi,
Can any one help on the third point?
c. Add annotations to provide a value help filter on the ‘Status text’ field based on Overall Status text.
2024 Aug 23 8:22 AM
Hi @diveshkalra ,
The task is to add 'Status text' field in the filter bar. As it has only 3 values we need to define an annotation which makes it is a value help where the values will be displayed and can be filtered on.
Hint: Check the Annotation TechByte video: https://www.youtube.com/watch?v=GXFHjq5L8M8&t=1030s
2024 Aug 23 8:28 AM
Hi @Shilpa_Shankar ,
I tried same way by following the youtube link but not sure where it's going wrong.
Below is the code:
@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'CDS View entity'
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType:{
serviceQuality: #X,
sizeCategory: #S,
dataClass: #MIXED
}
@UI.headerInfo.typeName: 'Travel'
@UI.headerInfo.typeNamePlural: 'Travels'
@Search.searchable: true
@ObjectModel.semanticKey: [ 'Description' ]
define view entity Ztravel_entity5 as select from ztravel_new5
association [0..1] to /DMO/I_Overall_Status_VH as _Status on _Status.OverallStatus = $projection.Status
{
@UI.lineItem: [{ position: 10 }]
@UI.selectionField: [{ position: 10 }]
key
travel_id as TravelId,
@UI.lineItem: [{ position: 20 }]
@Search.defaultSearchElement: true
@Search.fuzzinessThreshold: 0.90
description as Description,
@Semantics.amount.currencyCode: 'CurrencyCode'
@UI.lineItem: [{ position: 30 }]
total_price as TotalPrice,
currency_code as CurrencyCode,
@UI.lineItem: [{ position: 40 }]
concat_with_space( cast ( total_price as abap.char(25) ), currency_code, 1) as NewPriceCurrencyCode,
@UI.lineItem: [{ position: 50 }]
status as Status,
@UI.lineItem: [{ position: 60 }]
@UI.selectionField: [{ position: 20 }]
@Consumption.valueHelpDefinition: [{ entity: {name: 'zhelp_new5', element: 'overallStatus' } }]
_Status._Text.Text as overallStatusText,
_Status
}
2024 Aug 22 2:08 PM
Here is
2024 Aug 22 2:20 PM
2024 Aug 26 3:44 PM
Hi,
Thanks for the submission. Could you please search without a '*' ?
2024 Aug 22 2:55 PM
Hi team,
Please find the screenshots below,
All entries
With filer
Regards
Siva G
2024 Aug 23 8:09 AM
Hi @siva1990 ,
Thanks for the submission. For better readability you can filter out on the Status Text instead of the Status Code.
Regards,
Shilpa
2024 Aug 22 4:49 PM
Hi everyone,
Thank you for this August challenge—it's been incredibly interesting and I've learned a lot!
Here’s my solution:
1. Preview the app showing all the columns, search and filter options.
2. Search record based on vac descriptiond and Status accepted
2024 Aug 23 8:08 AM
Hi,
Thanks for the submission. Kindly add a search field for the challenge to be complete.
2024 Aug 22 6:32 PM
Will try fiddling with the Status filter as am sure that there's a way to make it more presentable.
2024 Aug 23 8:07 AM
Hi @geek ,
Thanks for the submission. For better readability you can filter out on the Status Text instead of the Status Code.
Regards,
Shilpa
2024 Aug 23 12:12 PM
@Shilpa_Shankar Thanks. It's the searching by text that I've struggled with. For textArrangement: #SEPARATE the search help is by technical key, so how to attach the search to the text field. Setting the textArrangement: #TEXT_ONLY shows Status as Text but removes the Technical value from the list:
2024 Aug 27 12:52 PM - edited 2024 Aug 27 12:54 PM
Hi @geek ,
This is how I do it. I have 2 fields Status which has technical key and StatusText which has corresponding values. For the Status field add this annotation:
@Consumption.valueHelpDefinition: [{ entity: { name: '/DMO/I_Overall_Status_VH',element: 'OverallStatus' } }]
@ObjectModel.text.element: [ 'StatusText' ]
@UI.textArrangement: #TEXT_ONLY
and hide the StatusText field as anyway the Text value will be displayed under Status
2024 Aug 27 5:59 PM
@Shilpa_Shankar That's where I ended up, see later posting describing it as a "fudge", spent a lot of time trying to use, @UI.textArrangement: #SEPARATE and attaching the Search to the Text, before adding a second Status field. Thanks for the feedback.
2024 Aug 23 6:02 PM
A bit of a fudge but:
2024 Aug 22 7:05 PM
Hello everyone, here is the screenshot for the initial state of the FIORI application
if we type 'Christine' on the description field, we get
We filter on Accepted status:
Looking forward for the next week already, as I find this enjoyable 😂💙
Have a great day 😉
2024 Aug 23 8:07 AM
Hi @Latifa
Thanks for the submission. For better readability you can filter out on the Status Text instead of the Status Code.
Regards,
Shilpa
2024 Aug 23 12:40 AM
2024 Aug 23 8:05 AM
Hi @Jorge_Cervantes,
Thanks for the submission. For better readability you can filter out on the Status Text instead of the Code.
Regards,
Shilpa
2024 Aug 23 3:32 AM
2024 Aug 23 7:38 AM
Hi Please find below my solution
2024 Aug 23 8:14 AM
2024 Aug 26 12:56 PM
Hi,
Kindly add consumption.valuehelpdefinition for the status field and map the text to the status text field.
You can use Objectmod.text
2024 Aug 23 9:42 AM - edited 2024 Aug 23 9:44 AM
👍💪
CDS View with no filter:
CDS View with description filter which is including 'vac' and status text filter:
CSS View with description filter which is including 'vac' ,travel ıd and status text filter:
2024 Aug 23 9:48 AM
1. All the columns, search and filter options;
2. Specific value from 'Description' field and value from the 'Status' field;
3. TravelId filter;
2024 Aug 23 9:58 AM
Preview of the App showing all the columns, search and filter options in the CDS view entity:
Search records based on a specific value from 'Description' field and select an available value from the 'Status' field.
2024 Aug 23 10:09 AM
My Solution:
2024 Aug 23 12:21 PM
Hi
My solution for this week
2024 Aug 23 12:40 PM
My Solution for Task 3:
2024 Aug 23 1:05 PM
Hi @sheenamk
1. Preview for all fields
Value Help for Status Text
2. Search records based on Description and Status text
2024 Aug 23 1:15 PM
Here is my preview for this weeks task:
2024 Aug 23 1:34 PM
Validation 1:
Validation 2:
Search with Description
Filter with Status
Filter with Travel Id
2024 Aug 23 1:45 PM
Task 3 Done!
1. All without filters
2. Using Description and Status
2024 Aug 26 12:48 PM
Hi @PedroARomero ,
Thanks for the submission. Please enable search field and search with a description.
2024 Aug 26 3:31 PM
Hi Shilpa
Yes, Filter with description
2024 Aug 26 5:20 PM
Hi Shilpa,
I didn't get well the idea. This is the correction using the @Search.searchable
and using the status filter
Regards
2024 Aug 23 1:57 PM