Dynamically Hide Fields and Actions in CDS
Learn how to dynamically hide fields, facets, and standard CRUD operations in CDS using boolean flag fields and @UI.hidden annotations.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"New field in the CDS View
case when EmployeeStatus = 'RETIRED'
then cast( 'X' as abap_boolean preserving type )
else cast( '' as abap_boolean preserving type )
end as HideCourseList
"Metadata Extensions
"Hide Facet in the Object Page
@UI.facet: [{ type: #LINEITEM_REFERENCE,
position: 20,
id: 'CourseData',
label: 'Courses',
targetElement: '_Courses',
purpose: #STANDARD,
hidden: #(HideCourseList) }
"Hide Standard Operations in the object page - Avaialble from S4HANA 2023+
@UI.createHidden: #(HideCourseList)
@UI.updateHidden: #(HideCourseList)
@UI.deleteHidden: #(HideCourseList)
annotate entity .....
with
"Hide Field
@UI.hidden: #(HideCourseList)
field_name;
"Hide field from Facet Group
@UI.identification: [{ hidden: #(HideCourseList) }]
field_name;
@UI.fieldGroup: [{ hidden: #(HideCourseList) }]
field_name;
"Etc,.
This post is licensed under CC BY 4.0 by the author.