Skip to content

Editable Treeview

MarinaBlank edited this page Feb 20, 2026 · 42 revisions

Feature Overview

An editable Treeview in a SAP Fiori application bound to a RAP-based OData V4 service displays hierarchical data in a tree table layout instead of a flat table structure. This allows users to view and maintain hierarchical relationships.

The editable Treeview enables users to:

  • Expand and collapse hierarchical nodes
  • Create new nodes within the hierarchy
  • Copy a hierarchy node
  • Modify existing nodes
  • Delete nodes
  • Reassign nodes to a different parent using drag-and-drop
  • Change the position of nodes within the same hierarchy level

image

Common business scenarios for this functionality are:

  • Organizational structures (e.g. organizational hierarchy: Manager → Employee)
  • Product structures (e.g. product hierarchy: Product → Module → Component)

This guide assists you in developing a hierarchy-based CDS model and and treeview-specific behavior.

💡 Development Effort: L 💡

Further Reading

Availability

This feature is available for the following products:

  • SAP BTP, ABAP environment as of 2502
  • SAP S/4HANA Cloud as of 2502
  • SAP S/4HANA and SAP S/4HANA Cloud, private edition as of 2025

Reference Scenario

If you get stuck or need a reference point, you may always refer to this /DMO/FLIGHT_HIERARCHY_DRAFT already present in the ABAP System, showcasing the Editable Treeview feature.


Development Guide

This guide provides links to official documentation on the SAP Help Portal, that contains the steps required to establish hierarchical relationships in the data model and enhance the standard behavior of a RAP BO with treeview features.

Prerequisites

  • Access to the AI5 ABAP System in a SAP BTP ABAP environment
  • Know your participant number, so you can identify your development package in the ABAP System
  • Make sure to have an up-to-date version of the ABAP Development Tools in Eclipse (ADT)

Create your BO with Hierarchical Relationships

The Editable Treeview feature requires specific hierarchical data modeling. That is why, for this feature you are not going to use the OData UI Service from Scratch generator. Instead, you will create your BO manually to adopt it directly to the hierarchical set-up.

Caution

Before you switch to the step-by-step guide in the documentation, please consider the following points.

  • The documentation doesn't describe in full detail that you need a projection view entity for both entities (Agency and Employee). When you reach the step Creating the Projection Layer and Metadata Extension, the documentation prompts you to create the projection view for Employee, but it doesn't refer to the projection view for the Agency entity. Please ensure to have the CDS Projection of your Agency entity before you proceed with the projection behavior definitions. You can check the reference scenario artefact, namely /DMO/C_AGENCYTP_HD for your reference. After a successful activation of both CDS Projections, you can continue with the step of Add projection in the behavior definition /DMO/C_AgencyTP_HD.
  • The reference scenario defines early internal numbering and uses a complex determination logic for drawing key values. To avoid extensive ABAP coding in the methods earlynumbering_create and earlynumbering_cba_employee you can either use external numbering (no numbering definition in the behavior definition and don't set the ID fields to read-only) or use a simplified example of number retrieval directly from the database table, see ZVM_BP_R_AGENCYTP_HD. (This is not recommended in real business scenarios)
  • The copy action also has an extensive implementation due to the recursive approach. The copy action itself is an optional feature of the treeview to complete the UI sequence CUT, COPY, PASTE. The treeview also works without the copy action.
  • If you want to use value helps, as indicated in the documentation, you can consume the value help views from the reference scenarios and you don't have to create your own value help views.

Important

For organization purposes, please use the pre-generated feature-specific package for Editable Treeview in AI5: ZDEVELOPER_TREEVIEW_###

Now follow the guide for Developing Apps with Hierarchical Data Structure with Draft Capabilities provided in the Develop section of the RAP documentation on the SAP Help Portal to create a business object with hierarchical data structures step-by-step.


Feature Enhancement Ideas

You can also create a RAP Service with the OData UI Service from Scratch Wizard and add hierarchical relationships to the data model and the treeview-specific behavior to the existing UI service. Be aware that the generator always creates UUID-field as keys and that this might lead to difficulties setting up the hierarchy.

Feedback

Technical Setup

  • A dedicated ABAP System in an SAP BTP ABAP environment (2602) is prepared for this event. Access the Fiori Launchpad here: AI5 Fiori Launchpad. Follow this link to create your ABAP Cloud Project in ADT
  • To logon to the service instance, use your assigned username and password.
  • You have been assigned a participant number (for example ###=042) and corresponding development packages ZDEVELOPER_### are already available in the system.
  • Please work inside your assigned packages. There is one subpackage for every feature available.

Resources

RAP Outlook

ABAP Platform - Roadmap Information

Tell us what you think

We appreciate your feedback. Use any of the options below:

  • Provide general feedback for a feature
    Let us know what you think about a feature you implemented:
    • Go to Issues in this repository. Choose New Issue-->Feature Feedback.
    • Select the feature label, complete the form with ratings and comments, and submit.
  • Report a problem (bug, documentation issue, enhancement idea, question)
    Help us improve the feature by reporting problems you experience during development:
    • Go to Issues in this repository. Choose New Issue-->Feature Problem Report.
    • Select the feature label and an additional problem category ( bug, documentation enhancement idea, question )
    • Describe your findings and submit.
  • Provide event feedback
    You will be asked to participate in a small survey when the event is concluded to give feedback regarding the CodeJam itself
  • Talk to the experts.

Clone this wiki locally