Kommentar verfassen
Das Schreiben von Kommentaren ist nur registrierten Benutzern erlaubt, die Registrierung ist kostenlos und erfordert keine E-Mail Adresse und kann schnell hier durchgeführt werden.
Das Schreiben von Kommentaren ist nur registrierten Benutzern erlaubt, die Registrierung ist kostenlos und erfordert keine E-Mail Adresse und kann schnell hier durchgeführt werden.
Hi, I have created a treeview following the article and it is working fine for a simple structure. But when I tried to add more logic, I get some errors.
In my case, I have the table with Parent/Node relation (I_GLAccountHierarchyNode) + another fields.
I would need to perform a join/association to another CDS (I_GLAccountLineItemRawData) using the field GLAccount from I_GLAccountHierarchyNode. The result is working fine on ADT preview, with multiple leafs for same node.
Ex. Parent Node1 - GLAccount1 - I_GLAccountLineItemRawData.ReferenceDocument Node1 - GLAccount1 - I_GLAccountLineItemRawData.ReferenceDocument
The problem is that field ReferenceDocument could have different values and I get the following error:
Hierarchy error: The hierarchy source data contains node XXXXX having multiple parents but the hierarchy is specified to reject such nodes.: line 1 col 260 (at pos 259)
Checking the node XXXXXX, on ADT preview, it is repeated (but same node + parent, with different ReferenceDocument values through join described before). I guess the framework is generating something like virtual relation while rendering the tree and they are considered different.
Any idea?
Hi afc,
have you checked the hierarchy in preview mode in ADT if all items and nodes are correct and no multiple items are visible? The hierarchy is the base for the RAP tree and if you see multiple items there, you should fix them first.
Also the tree have the associations defined to get the parent for example. You could also check the association, if it returnes one entry, when you access the association with the parent id.
Greetings Björn
Thanks Björn, I was finally able to solve the issue with a litle workaround. The problem was that same node (key field) with same parent was several times and it fails.The workaround: concat key fields for node. Now I have another problem, Fiori elements preview works fine, but after deploying with BAS, the tree is not working. ¿Maybe because of paging? I will investigate.
Hi,
very nice description, thanks. But is such implementation possible also on premise 2023 version or only on cloud?
It seems the hierarchy object is not supported on premise. Is there an alternative for on premise version?
Thanks.
Hello Juraj, the hierarchy is coming with the 2025 release. That's the actual problem of a two year release cycle for On-Prem. It's possible, but only with some additions and freestyle. But with 2025 there will also be the editable tree version.
Greetings Björn
Hi Björn,
thanks for the quick response. Do you have probably an idea on how the additions/freeastyle would look like?
Thanks and have a nice weekend Juraj
I would say you have to use the Tree Control in Fiori, to get this done, but I'm not the Fiori developer.
Typ-Mapping Error
Hi together,
I tried to implement a hierarchy in a ticketsystem but when i add the annotation i get the error "Fehler in Entität 'ZCTS_C_TICKET(CDS)': Typ-Mapping von Wert '' für Datenelement '&DD_CDS_OBJECT_TYPE&' ist fehlgeschlagen" what translates to Error in Type-Mapping of Value '' for Type '&DD_CDS_OBJECT_TYPE&
Any idea what causes the error? Thanks in advance Adrian
Hello Adrian,
this is the first time I've heard of this error. Do you perhaps have an empty value in a key field or in another relevant field? On which release are you trying to implement this feature?
Grettings Björn
Hi Björn,
My tables are empty. I am implementing this feature on a btp abap enviroment. I am using "root table entity" as my active persistance. I also tried it with normal tables but the error is still threre also i tried using no cds types but the error is still there. My tables looks like this.
@ClientHandling.type: #CLIENT_DEPENDENT @AbapCatalog.deliveryClass: #APPLICATION_DATA @AccessControl.authorizationCheck: #NOT_REQUIRED @EndUserText.label: '#Ticket Ticket Active Persistance'
define root table entity /CPT/CTS_Ticket { key TicketID : /CPT/CTS_TicketID; Ticketnumber : /CPT/CTS_Ticketnumber; ParentTicketID : /CPT/CTS_ParentTicketID; Status : /CPT/CTS_Ticketstatus; Title : abap.string(0) null; Description : abap.string(0) null;
}
@AccessControl.authorizationCheck: #NOT_REQUIRED @EndUserText.label: '#Ticket Ticket Consumption' @Metadata.ignorePropagatedAnnotations: false @OData.hierarchy.recursiveHierarchy: [{entity.name: '/CPT/CTS_H_Ticket'}] @Metadata.allowExtensions: true
@ObjectModel.semanticKey: [ 'Ticketnumber' ]
define root view entity /CPT/CTS_C_Ticket provider contract transactional_query as projection on /CPT/CTS_Ticket
association of many to one /CPT/CTS_C_Ticket as _ParentTicket on $projection.ParentTicketID = _ParentTicket.TicketID
{
key /CPT/CTS_Ticket.TicketID, /CPT/CTS_Ticket.Ticketnumber, /CPT/CTS_Ticket.ParentTicketID, /CPT/CTS_Ticket.Status, /CPT/CTS_Ticket.Title, /CPT/CTS_Ticket.Description, /CPT/CTS_Ticket.CreatedBy, /CPT/CTS_Ticket.CreatedAt, /CPT/CTS_Ticket.LastChangedBy, /CPT/CTS_Ticket.LastChangedAt, /CPT/CTS_Ticket.LocalLastChangedBy, /CPT/CTS_Ticket.LocalLastChangedAt, / Associations / _Attachments : redirected to composition child /CPT/CTS_C_TicketAttachment, _ParentTicket }
@AccessControl.authorizationCheck: #NOT_REQUIRED define hierarchy /CPT/CTS_H_Ticket as parent child hierarchy( source /CPT/CTS_Ticket child to parent association _ParentTicket start where ParentTicketID is null siblings order by Ticketnumber ascending ) { key TicketID, ParentTicketID }
Greetings Adrian
Ok i found the error. define root table entity doesnt work with hierarchy.
root table entiry - > consumption view => doesnt work table entity -> rap view entity -> consumption view => works
Greetings Adrian