SAP RAP Interface Views Explained: Root & Child Views

In our last blog, we have created simple CDS views for our use case of a Travel Application. In this blog of SAP RAP Managed Scenario we will declare our views as root(parent) and child entities with associations and composition relationship between them to complete our data model. But first let us understand Interface – Root views and Child views.

What is an Interface View in SAP RAP?

An Interface View is a CDS view entity that represents the canonical data model for a RAP BO. It defines fields, keys, associations, and compositions that form the BO hierarchy. You can further define your view as root view or child view and establish relationship between them.

Why Interface Views Matter in RAP?

In the RAP stack, your CDS layers map like this:

  • Interface Views → stable domain model (canonical structure & associations)
  • Behavior Definitions/Implementations → transactional semantics & logic
  • Projection Views → tailored consumption (UI, OData APIs)

This separation gives you:

  • Reuse and stability: Interface views remain stable even as UI projections change.
  • Clean governance: One canonical truth for data model & compositions.
  • Performance: CDS View Entities are optimized for modern ABAP stack (HANA pushdown where applicable).

Think of interface views as the “source of truth” for your BO, with root and child defining the BO hierarchy.

Root vs Child Interface Views

Root Interface View

  • Represents the root entity of the BO (e.g., SalesOrder)
  • Declares key, composition to children, associations, and semantics
  • Used by the root behavior definition

Child Interface View

  • Represents composed entities (e.g., SalesOrderItem)
  • Has a backlink association to root and a composition of root reference in behavior definition
  • Includes own keys and relevant foreign keys/UUIDs

How do Root and Child Views relate?

The root view represents the BO root and declares composition to child views in SAP RAP. Children model dependent parts (e.g., items), inherit lifecycle from the root, and typically use dependent locks.

SAP RAP, ABAP RESTful Application Programming Model, CDS, Interface View, Root View, Child View, Projection View, Behavior Definition, RAP BO, Managed Scenario, Unmanaged Scenario

Now let us start with our application. We have created our interface view as below till now. We will make this as our root view or parent view.
But before we do that we will create the child entities. Once child entities are created we will establish the relationship and activate them all at once.

SAP RAP, ABAP RESTful Application Programming Model, CDS, Interface View, Root View, Child View, Projection View, Behavior Definition, RAP BO, Managed Scenario, Unmanaged Scenario

Now let us create entity on booking table –  /dmo/booking  and booking supplement – /dmo/booksuppl table which will be our child entity.

Right click on package -> New and select data definition.

SAP RAP, ABAP RESTful Application Programming Model, CDS, Interface View, Root View, Child View, Projection View, Behavior Definition, RAP BO, Managed Scenario, Unmanaged Scenario

Provide the name, description and reference object on which we want our interface view to be created.

SAP RAP, ABAP RESTful Application Programming Model, CDS, Interface View, Root View, Child View, Projection View, Behavior Definition, RAP BO, Managed Scenario, Unmanaged Scenario

Click next and select Define view entity and finish.

SAP RAP, ABAP RESTful Application Programming Model, CDS, Interface View, Root View, Child View, Projection View, Behavior Definition, RAP BO, Managed Scenario, Unmanaged Scenario

Now let us solve the errors here. We already know we need to use semantics annotations for the amount/price error.

SAP RAP, ABAP RESTful Application Programming Model, CDS, Interface View, Root View, Child View, Projection View, Behavior Definition, RAP BO, Managed Scenario, Unmanaged Scenario

Now we will associate this view with other views to get details like customer name, carrier name because in frontend we will need to display these.

For Airline details we have view /dmo/i_carrier and for customer as /dmo/i_customer.

For Connection details we have /dmo/i_connection view.

SAP RAP, ABAP RESTful Application Programming Model, CDS, Interface View, Root View, Child View, Projection View, Behavior Definition, RAP BO, Managed Scenario, Unmanaged Scenario

Now In the same way we will create view for booking supplement also.

Right click on package -> New and select data definition.

Enter details and create our view same way as previously.

SAP RAP, ABAP RESTful Application Programming Model, CDS, Interface View, Root View, Child View, Projection View, Behavior Definition, RAP BO, Managed Scenario, Unmanaged Scenario

SAP RAP, ABAP RESTful Application Programming Model, CDS, Interface View, Root View, Child View, Projection View, Behavior Definition, RAP BO, Managed Scenario, Unmanaged Scenario

Now for booking supplement we will create associations to get booking supplement details from /DMO/I_Supplement and texts from /DMO/I_SupplementText.

SAP RAP, ABAP RESTful Application Programming Model, CDS, Interface View, Root View, Child View, Projection View, Behavior Definition, RAP BO, Managed Scenario, Unmanaged Scenario

Now you might ask how we know the cardinality of an association or the fields for the on condition.
Valid question but remember associations are like joins on demand. So if you open the view which you want to associate with and check its primary keys and data in the table you should get a pretty good idea.
Lets take example of /DMO/I_SupplementText.
Tip: You can open an object in eclipse by Ctrl+Click on that object or Ctrl+Shift+A and enter the object name.

SAP RAP, ABAP RESTful Application Programming Model, CDS, Interface View, Root View, Child View, Projection View, Behavior Definition, RAP BO, Managed Scenario, Unmanaged Scenario

Here if we check this table has two key fields supplement_id and language_code. Let’s check the data. Press F8.

SAP RAP, ABAP RESTful Application Programming Model, CDS, Interface View, Root View, Child View, Projection View, Behavior Definition, RAP BO, Managed Scenario, Unmanaged Scenario

So we can have the text maintained in different languages. If we are passing only Id then there can be multiple texts or lines of this table for that supplement id. So we need to give [1..*] cardinality to it.
Now let us define the relationship between our parent entity(Travel) with its child(booking) and grandchild(booking supplement).
For this we will define our travel entity as root entity and declare its child.

SAP RAP, ABAP RESTful Application Programming Model, CDS, Interface View, Root View, Child View, Projection View, Behavior Definition, RAP BO, Managed Scenario, Unmanaged Scenario

Remember composition is not a loosely coupled relationship like association. The cardinality tells that there can be no or n number of childs or bookings for a single travel.
We will still have this error until we declare this relationship at child level also.

SAP RAP, ABAP RESTful Application Programming Model, CDS, Interface View, Root View, Child View, Projection View, Behavior Definition, RAP BO, Managed Scenario, Unmanaged Scenario

We have used association to parent in the child entity to define this relationship.
Now we will try to activate both these view together. Ctrl+Shift+F3.
Now let us try to establish relationship between booking and booking supplement.

SAP RAP, ABAP RESTful Application Programming Model, CDS, Interface View, Root View, Child View, Projection View, Behavior Definition, RAP BO, Managed Scenario, Unmanaged Scenario

In the child view we use association to parent and define composition of in the parent node same as we did for Booking and Travel views.
Now we can consume our views as it is with all the fields or we can create projections views on top of these and define UI annotations for only what is needed for our application. We will understand this in our next blog.

Leave a Comment

Your email address will not be published. Required fields are marked *