From 456b4763e8ff7d66d47b3b7f23791edf888461bb Mon Sep 17 00:00:00 2001 From: Evgeny Andreev Date: Tue, 5 Aug 2025 10:02:28 +0200 Subject: [PATCH 01/11] Document Tree Views --- advanced/fiori.md | 92 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 89 insertions(+), 3 deletions(-) diff --git a/advanced/fiori.md b/advanced/fiori.md index a2f03918c..6b2201b27 100644 --- a/advanced/fiori.md +++ b/advanced/fiori.md @@ -714,8 +714,94 @@ The `max-age` is the elapsed time since the response was generated on the origin Cache Control feature is currently supported on the Java runtime only. ::: -
-
+## Hierarchical Tree Views -
+Recursive hierarchies are parent-child hierarchies, where each entity references its parent and through that defines the hierarchical structure. A common example is a company organization structure or HR reporting, where each employee entity references another employee a as direct report or manager. + +Generic implementation is supported on the following databases for both CAP runtimes: + +| Runtime\DB | SAP HANA | H2 | PostgreSQL | SQLite | +|-------------|----------|----|------------|--------| +| CAP Java | ✓ | ✓ | ✓ | | +| CAP Node.js | ✓ | |✓ |✓ | + +:::info +The source elements of the entity defining the recursive parent-child relation are identified by a naming convention or aliases `node_id` and `parent_id`. + + +### Configuration + +Given the following domain model: + +```cds +entity Genres { //... + parent : Association to Genres; +} +``` + +#### Configure the TreeTable in UI5's _manifest.json_ + +```jsonc + "sap.ui5": { ... + "routing": { ... + "targets": { ... + "GenresList": { ... + "options": { + "settings": { ... + "controlConfiguration": { + "@com.sap.vocabularies.UI.v1.LineItem": { + "tableSettings": { + "hierarchyQualifier": "GenresHierarchy", // [!code focus] + "type": "TreeTable" // [!code focus] + } + } + } + } + } + }, + }, + }, +``` + +> Note: `hierarchyQualifier` should be chosen as:
+> `"Hierarchy"` + +#### Annotate/extend the entity in the service as follows: + +```cds +annotate AdminService.Genres with @Aggregation.RecursiveHierarchy #GenresHierarchy : { + ParentNavigationProperty : parent, // navigates to a node's parent + NodeProperty : ID, // identifies a node, usually the key +}; + +// Fiori expects the following to be defined explicitly, even though they're always the same +extend AdminService.Genres with @( + // The columns expected by Fiori to be present in hierarchy entities + Hierarchy.RecursiveHierarchy #GenresHierarchy : { + LimitedDescendantCount : LimitedDescendantCount, + DistanceFromRoot : DistanceFromRoot, + DrillState : DrillState, + LimitedRank : LimitedRank + }, + // Disallow filtering on these properties from Fiori UIs + Capabilities.FilterRestrictions.NonFilterableProperties: [ + 'LimitedDescendantCount', + 'DistanceFromRoot', + 'DrillState', + 'LimitedRank' + ], + // Disallow sorting on these properties from Fiori UIs + Capabilities.SortRestrictions.NonSortableProperties : [ + 'LimitedDescendantCount', + 'DistanceFromRoot', + 'DrillState', + 'LimitedRank' + ], +) columns { // Ensure we can query these fields from database + null as LimitedDescendantCount : Int16, + null as DistanceFromRoot : Int16, + null as DrillState : String, + null as LimitedRank : Int16, +}; +``` From f004732cd5208e8048f54f9f14e55e06e3202b38 Mon Sep 17 00:00:00 2001 From: Evgeny Andreev Date: Mon, 11 Aug 2025 12:41:16 +0200 Subject: [PATCH 02/11] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Adrian Görler --- advanced/fiori.md | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/advanced/fiori.md b/advanced/fiori.md index 6b2201b27..afe3effd5 100644 --- a/advanced/fiori.md +++ b/advanced/fiori.md @@ -719,16 +719,13 @@ Cache Control feature is currently supported on the Java runtime only. Recursive hierarchies are parent-child hierarchies, where each entity references its parent and through that defines the hierarchical structure. A common example is a company organization structure or HR reporting, where each employee entity references another employee a as direct report or manager. -Generic implementation is supported on the following databases for both CAP runtimes: +A generic implementation is supported on the following databases for the respective CAP runtimes: | Runtime\DB | SAP HANA | H2 | PostgreSQL | SQLite | |-------------|----------|----|------------|--------| | CAP Java | ✓ | ✓ | ✓ | | | CAP Node.js | ✓ | |✓ |✓ | -:::info -The source elements of the entity defining the recursive parent-child relation are identified by a naming convention or aliases `node_id` and `parent_id`. - ### Configuration @@ -775,9 +772,8 @@ annotate AdminService.Genres with @Aggregation.RecursiveHierarchy #GenresHierarc NodeProperty : ID, // identifies a node, usually the key }; -// Fiori expects the following to be defined explicitly, even though they're always the same extend AdminService.Genres with @( - // The columns expected by Fiori to be present in hierarchy entities + // The computed properties expected by Fiori to be present in hierarchy entities Hierarchy.RecursiveHierarchy #GenresHierarchy : { LimitedDescendantCount : LimitedDescendantCount, DistanceFromRoot : DistanceFromRoot, @@ -786,19 +782,13 @@ extend AdminService.Genres with @( }, // Disallow filtering on these properties from Fiori UIs Capabilities.FilterRestrictions.NonFilterableProperties: [ - 'LimitedDescendantCount', - 'DistanceFromRoot', - 'DrillState', - 'LimitedRank' + 'LimitedDescendantCount', 'DistanceFromRoot', 'DrillState', 'LimitedRank' ], // Disallow sorting on these properties from Fiori UIs Capabilities.SortRestrictions.NonSortableProperties : [ - 'LimitedDescendantCount', - 'DistanceFromRoot', - 'DrillState', - 'LimitedRank' + 'LimitedDescendantCount', 'DistanceFromRoot', 'DrillState', 'LimitedRank' ], -) columns { // Ensure we can query these fields from database +) columns { // Ensure we can query these columns from the database null as LimitedDescendantCount : Int16, null as DistanceFromRoot : Int16, null as DrillState : String, From 0cfa43d5b03338485ad1f228724cdf3743eb6302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20G=C3=B6rler?= Date: Mon, 11 Aug 2025 13:23:56 +0200 Subject: [PATCH 03/11] Update fiori.md --- advanced/fiori.md | 66 ++++++++++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 26 deletions(-) diff --git a/advanced/fiori.md b/advanced/fiori.md index afe3effd5..77f7e98e5 100644 --- a/advanced/fiori.md +++ b/advanced/fiori.md @@ -732,44 +732,28 @@ A generic implementation is supported on the following databases for the respect Given the following domain model: ```cds +namespace my.bookshop; + entity Genres { //... parent : Association to Genres; } ``` -#### Configure the TreeTable in UI5's _manifest.json_ +and this projection on service level -```jsonc - "sap.ui5": { ... - "routing": { ... - "targets": { ... - "GenresList": { ... - "options": { - "settings": { ... - "controlConfiguration": { - "@com.sap.vocabularies.UI.v1.LineItem": { - "tableSettings": { - "hierarchyQualifier": "GenresHierarchy", // [!code focus] - "type": "TreeTable" // [!code focus] - } - } - } - } - } - }, - }, - }, +```cds +service AdminService { + entity Genres as projection on my.bookshop.Genres; +} ``` -> Note: `hierarchyQualifier` should be chosen as:
-> `"Hierarchy"` - #### Annotate/extend the entity in the service as follows: ```cds +// declare a hierarchy with the qualifier "GenresHierarchy" annotate AdminService.Genres with @Aggregation.RecursiveHierarchy #GenresHierarchy : { - ParentNavigationProperty : parent, // navigates to a node's parent - NodeProperty : ID, // identifies a node, usually the key + NodeProperty : ID, // identifies a node, usually the key + ParentNavigationProperty : parent // navigates to a node's parent }; extend AdminService.Genres with @( @@ -795,3 +779,33 @@ extend AdminService.Genres with @( null as LimitedRank : Int16, }; ``` + +> Note: hierarchy qualifier should be chosen as:
+> `Hierarchy` + +#### Configure the TreeTable in UI5's _manifest.json_ + +```jsonc + "sap.ui5": { ... + "routing": { ... + "targets": { ... + "GenresList": { ... + "options": { + "settings": { ... + "controlConfiguration": { + "@com.sap.vocabularies.UI.v1.LineItem": { + "tableSettings": { + "hierarchyQualifier": "GenresHierarchy", // [!code focus] + "type": "TreeTable" // [!code focus] + } + } + } + } + } + }, + }, + }, +``` + +> Note: use the `hierarchyQualifier` declared above + From 255afccc4e6a9cc2ecf50ff61cf58c3ce1f78348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20G=C3=B6rler?= Date: Mon, 11 Aug 2025 13:24:51 +0200 Subject: [PATCH 04/11] Update advanced/fiori.md --- advanced/fiori.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/fiori.md b/advanced/fiori.md index 77f7e98e5..c4fad99c8 100644 --- a/advanced/fiori.md +++ b/advanced/fiori.md @@ -776,7 +776,7 @@ extend AdminService.Genres with @( null as LimitedDescendantCount : Int16, null as DistanceFromRoot : Int16, null as DrillState : String, - null as LimitedRank : Int16, + null as LimitedRank : Int16 }; ``` From 7000dc6c4c7f61db5155a5ba7f0a9034af551d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20G=C3=B6rler?= Date: Tue, 12 Aug 2025 13:13:35 +0200 Subject: [PATCH 05/11] Update advanced/fiori.md Co-authored-by: Evgeny Andreev --- advanced/fiori.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/fiori.md b/advanced/fiori.md index c4fad99c8..cfc6e1990 100644 --- a/advanced/fiori.md +++ b/advanced/fiori.md @@ -739,7 +739,7 @@ entity Genres { //... } ``` -and this projection on service level +and its projection on service level ```cds service AdminService { From 7d381b0cff9cfcf7148e1b149b3a7e4f1ef47e12 Mon Sep 17 00:00:00 2001 From: Evgeny Andreev Date: Fri, 10 Oct 2025 08:32:24 +0200 Subject: [PATCH 06/11] Update advanced/fiori.md --- advanced/fiori.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/advanced/fiori.md b/advanced/fiori.md index bdc4baf7d..67e48a50e 100644 --- a/advanced/fiori.md +++ b/advanced/fiori.md @@ -835,3 +835,5 @@ extend AdminService.Genres with @( > Note: use the `hierarchyQualifier` declared above +
+ From 61ebbbab9019186bb11f9e694e73517778353af3 Mon Sep 17 00:00:00 2001 From: Mahati Shankar <93712176+smahati@users.noreply.github.com> Date: Thu, 23 Oct 2025 15:07:23 +0200 Subject: [PATCH 07/11] cosmetics --- advanced/fiori.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/advanced/fiori.md b/advanced/fiori.md index 93c476183..3aa7202ae 100644 --- a/advanced/fiori.md +++ b/advanced/fiori.md @@ -743,9 +743,9 @@ Cache Control feature is currently supported on the Java runtime only. ## Hierarchical Tree Views -Recursive hierarchies are parent-child hierarchies, where each entity references its parent and through that defines the hierarchical structure. A common example is a company organization structure or HR reporting, where each employee entity references another employee a as direct report or manager. +Recursive hierarchies are parent-child hierarchies, where each entity references its parent and through that defines the hierarchical structure. A common example is a company organization structure or HR reporting, where each employee entity references another employee as a direct report or manager. -A generic implementation is supported on the following databases for the respective CAP runtimes: +Database support for a generic hierarchy implementation by CAP runtime: | Runtime\DB | SAP HANA | H2 | PostgreSQL | SQLite | |-------------|----------|----|------------|--------| @@ -765,7 +765,7 @@ entity Genres { //... } ``` -and its projection on service level +and its projection in a service ```cds service AdminService { @@ -773,7 +773,7 @@ service AdminService { } ``` -#### Annotate/extend the entity in the service as follows: +#### Annotate/extend the entity in the service: ```cds // declare a hierarchy with the qualifier "GenresHierarchy" @@ -806,10 +806,10 @@ extend AdminService.Genres with @( }; ``` -> Note: hierarchy qualifier should be chosen as:
+> Note: When naming the hierarchy qualifier, use the following pattern:
> `Hierarchy` -#### Configure the TreeTable in UI5's _manifest.json_ +#### Configure the TreeTable in UI5's _manifest.json_ file: ```jsonc "sap.ui5": { ... From daf3852a4b60eb4f179398781847aafdce3af53c Mon Sep 17 00:00:00 2001 From: Mahati Shankar <93712176+smahati@users.noreply.github.com> Date: Thu, 23 Oct 2025 15:43:08 +0200 Subject: [PATCH 08/11] cosmetics --- advanced/fiori.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/fiori.md b/advanced/fiori.md index 3aa7202ae..36ca408bd 100644 --- a/advanced/fiori.md +++ b/advanced/fiori.md @@ -833,7 +833,7 @@ extend AdminService.Genres with @( }, ``` -> Note: use the `hierarchyQualifier` declared above +> Note: use the `hierarchyQualifier` declared earlier
From e461e1e5f33ad9c6422bbb0115a1c4a2fc67658f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20G=C3=B6rler?= Date: Mon, 27 Oct 2025 13:45:54 +0100 Subject: [PATCH 09/11] Update fiori.md --- advanced/fiori.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/advanced/fiori.md b/advanced/fiori.md index 36ca408bd..ba3ea7f83 100644 --- a/advanced/fiori.md +++ b/advanced/fiori.md @@ -740,6 +740,9 @@ The `max-age` is the elapsed time since the response was generated on the origin Cache Control feature is currently supported on the Java runtime only. ::: +
+ +
## Hierarchical Tree Views From 11867e6f2a5420665951cf92fcdcf5738f3ec21b Mon Sep 17 00:00:00 2001 From: Rene Jeglinsky Date: Tue, 4 Nov 2025 11:56:30 +0100 Subject: [PATCH 10/11] edit --- advanced/fiori.md | 9 ++++----- menu.md | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/advanced/fiori.md b/advanced/fiori.md index ba3ea7f83..5245acfb9 100644 --- a/advanced/fiori.md +++ b/advanced/fiori.md @@ -1,5 +1,4 @@ --- -shorty: Fiori UIs synopsis: > CAP provides out-of-the-box support for SAP Fiori elements front ends. permalink: advanced/fiori @@ -9,7 +8,7 @@ impl-variants: true uacp: Used as link target from Help Portal at https://help.sap.com/products/BTP/65de2977205c403bbc107264b8eccf4b/e4a7559baf9f4e4394302442745edcd9.html --- -# Serving Fiori UIs +# Serving SAP Fiori UIs {{ $frontmatter.synopsis }} @@ -23,13 +22,13 @@ This guide explains how to add one or more SAP Fiori elements apps to a CAP proj ## SAP Fiori Preview -For entities exposed via OData V4 there is a _Fiori preview_ link on the index page. It dynamically serves an SAP Fiori Elements list page that allows you to quickly see the effect of annotation changes without having to create a UI application first. +For entities exposed via OData V4 there is a _Fiori preview_ link on the index page. It dynamically serves an SAP Fiori elements list page that allows you to quickly see the effect of annotation changes without having to create a UI application first. ::: details Be aware that this is **not meant for production**.
-The preview not meant as a replacement for a proper SAP Fiori Elements (UI5) application. +The preview is not meant as a replacement for a proper SAP Fiori elements (UI5) application. It is only active locally where the [development profile](../node.js/cds-env#profiles) is enabled. To also enable it in cloud deployments, for test or demo purposes maybe, set cds.fiori.preview:true. @@ -38,7 +37,7 @@ To also enable it in cloud deployments, for test or demo purposes maybe, set -The preview not meant as a replacement for a proper SAP Fiori Elements (UI5) application. +The preview is not meant as a replacement for a proper SAP Fiori elements (UI5) application. It is active by default, but disabled automatically in case the [production profile](../java/developing-applications/configuring#production-profile) is enabled. To also enable it in cloud deployments, for test or demo purposes maybe, set cds.index-page.enabled:true. diff --git a/menu.md b/menu.md index 56e3f7a37..959b213a5 100644 --- a/menu.md +++ b/menu.md @@ -55,7 +55,7 @@ ### [AsyncAPI](advanced/publishing-apis/asyncapi) ## [Serving UIs](advanced/fiori) - ### [Fiori UIs](advanced/fiori) + ### [SAP Fiori UIs](advanced/fiori) ## [Databases](guides/databases) From 02ab50eaf2886fd0a49a83ad7cc8ced52cd2b236 Mon Sep 17 00:00:00 2001 From: Rene Jeglinsky Date: Tue, 4 Nov 2025 12:05:47 +0100 Subject: [PATCH 11/11] edit --- advanced/fiori.md | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/advanced/fiori.md b/advanced/fiori.md index 5245acfb9..dde6e4c7a 100644 --- a/advanced/fiori.md +++ b/advanced/fiori.md @@ -747,7 +747,7 @@ Cache Control feature is currently supported on the Java runtime only. Recursive hierarchies are parent-child hierarchies, where each entity references its parent and through that defines the hierarchical structure. A common example is a company organization structure or HR reporting, where each employee entity references another employee as a direct report or manager. -Database support for a generic hierarchy implementation by CAP runtime: +Database support for a generic hierarchy implementation by CAP runtimes: | Runtime\DB | SAP HANA | H2 | PostgreSQL | SQLite | |-------------|----------|----|------------|--------| @@ -755,27 +755,29 @@ Database support for a generic hierarchy implementation by CAP runtime: | CAP Node.js | ✓ | |✓ |✓ | -### Configuration +### Example +Let's assume we have the following domain model and its projection in a service: -Given the following domain model: - -```cds +::: code-group +```cds [schema.cds] namespace my.bookshop; entity Genres { //... parent : Association to Genres; } ``` +::: -and its projection in a service - -```cds +::: code-group +```cds [AdminService.cds] service AdminService { entity Genres as projection on my.bookshop.Genres; } ``` +::: + -#### Annotate/extend the entity in the service: +Annotate/extend the entity in the service as follows: ```cds // declare a hierarchy with the qualifier "GenresHierarchy" @@ -811,7 +813,7 @@ extend AdminService.Genres with @( > Note: When naming the hierarchy qualifier, use the following pattern:
> `Hierarchy` -#### Configure the TreeTable in UI5's _manifest.json_ file: +Configure the TreeTable in UI5's _manifest.json_ file: ```jsonc "sap.ui5": { ...