2024 Feb 15 4:33 PM - edited 2024 Feb 15 4:46 PM
Hello Gurus,
I have a RAP based Fiori App (OData V2).
On the app's List Report page there is a list of all my Products and some Products have Sub-Products (Parent-Child Relationship). Currently the Products are displayed in a Responsive Table as a flat structure, but I want to display them in a Tree Table.
I researched this question and found that I need to create a hierarchy using CDS views and only then make some additional changes on the frontend side.
I followed the guide to create a hierarchy and expose it (code below), but to no avail.
Would be grateful for any help (hint, links, articles) from your side.
Regards,
Andre
define view entity Z_I_ProductItem
as select from zt_product_i
association [0..1] to Z_I_ProductItem as _ParentProductItem on $projection.ParentGUID = _ParentProductItem.ProductGUID
{
key product_guid as ProductGUID,
product_name as ProductName,
parent_guid as ParentGUID,
_ParentProductItem
}
define hierarchy Z_I_ProductItemHier
as parent child hierarchy(
source Z_I_ProductItem
child to parent association _ParentProductItem
start where
ParentGUID is initial
siblings order by
ProductName ascending
)
{
key ProductGUID,
ParentGUID
}
define view entity Z_I_ProductItemTP
as select from Z_I_ProductItem as _ProductItem
{
key _ProductItem.ProductGUID,
// Some fields
ParentGUID,
_ParentProductItem
}
@OData.hierarchy.recursiveHierarchy:[{ entity.name: 'Z_I_ProdItemHier' }]
define view entity Z_C_ProductItemListRepPage
as projection on Z_I_ProductItemTP as _ProductItemTP
{
key ProductGUID,
ProductName,
ParentGUID,
_ParentProductItem
}
Request clarification before answering.
User | Count |
---|---|
76 | |
30 | |
9 | |
8 | |
8 | |
7 | |
7 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.