In the world of ABAP RESTful Application Programming Model (RAP), understanding the core concepts of Business Objects, ABAP RAP Composition vs Association is fundamental to building robust, efficient, and truly modern SAP applications. These elements are the building blocks that enable the creation of powerful OData services for SAP Fiori applications and web APIs.
This guide will demystify these critical RAP concepts, helping you design and implement resilient transactional applications in SAP S/4HANA and the SAP BTP ABAP environment and also understand ABAP RAP Composition vs Association.
The ABAP RAP Journey: From Data to Service Consumption

Creating an OData service using the ABAP RAP typically follows a three-part journey:
- Data Modeling and Behavior: This foundational phase involves defining your data model using CDS (Core Data Services) views. CDS acts as the semantic layer, allowing you to fetch and model data from various tables. Crucially, this stage also defines the behavior of your data model – including standard CRUD (Create, Update, Delete) operations and custom actions. For transactional access, Business Objects are introduced here to encapsulate this behavior and its ABAP implementation.
- Business Service Provisioning: Once your data model and behavior are defined, this step focuses on exposing it as a service. You decide which part of your data model will be consumed, the protocol (e.g., OData V2 or V4), and the service’s purpose (e.g., a Fiori UI or a generic web API).
- Service Consumption: The final stage is where your meticulously crafted OData service comes to life. It’s consumed by client applications, most commonly SAP Fiori applications, or by other external web APIs.
Demystifying Business Objects in ABAP RAP
At the heart of any transactional application in RAP lies the Business Object. Think of a Business Object as a digital representation of a real-world entity, like a Sales Order, a Travel Booking, or a Product.
Key characteristics that define a Business Object in RAP include:
- Hierarchy: Business Objects are inherently structured in a hierarchy. For instance, a Sales Order might have multiple Line Items, each with its own Schedule Line Items.
- Actions: Beyond standard CRUD operations (Create, Update, Delete), Business Objects define specific actions relevant to their domain, such as “Approve Sales Order” or “Release Travel Request.”
- Structure, Behavior, and Runtime Implementation: A Business Object isn’t just data; it’s a complete package encompassing:
- Structure: Its data model (defined by CDS views).
- Behavior: Rules for how it acts and reacts (defined in behavior definitions).
- Runtime Implementation: The actual ABAP code that executes its behavior.
The Composition Tree: Structuring Your Data
Within the hierarchical structure of a Business Object, the Composition Tree visually represents the parent-child relationships between different nodes. This tree-like structure is crucial for defining how parts of your Business Object relate to and depend on each other. Each node in this tree is typically a CDS entity.
Association vs. Composition: The Key Distinction in ABAP RAP
This is often where confusion arises, but understanding the difference between Association and Composition is vital for correct ABAP RAP data modeling:
- Association (Loose Relationship):
- An Association defines a loose relationship between two CDS entities.
- Crucially, the child entity can exist independently of its parent in an association.
- If you delete the parent entity, the associated child entity is NOT automatically deleted. Think of a relationship between a Customer and an Address; an address can exist even if a specific customer record is removed (perhaps it’s linked to other customers or used elsewhere).
- Composition (Strong Relationship):
- A Composition signifies a stronger type of relationship where the child entity cannot exist without its parent.
- If a parent entity is deleted, all associated child entities are also automatically deleted.
- Compositions typically use a one-to-many cardinality. A classic example is a Sales Order and its Line Items: a Sales Order Line Item makes no sense without the context of its parent Sales Order. Deleting the Sales Order logically means deleting all its associated line items.

Choosing between an Association and a Composition directly impacts your transactional application’s data integrity and behavior within ABAP RAP.
Understanding Nodes: Root and Leaf Entities
Within the Composition Tree, specific terms define the position of entities:
- Root Node: This is the top-level node in the hierarchy. It represents the entire Business Object (e.g., the Sales Order header). Every Business Object has one and only one root node.
- Leaf Entity: A leaf entity is the last node in a specific branch of the hierarchy. It has a parent but no child nodes of its own (e.g., a Schedule Line Item, if it doesn’t have further sub-items).

Build Robust ABAP RAP Applications
By grasping the nuances of Business Objects, the Composition Tree, and the critical distinction between Association and Composition, you lay a solid foundation for developing high-performing and reliable ABAP RAP applications. These concepts are integral to designing the data model and behavior for any transactional application in the modern SAP landscape.
Read More – Mastering ABAP RAP: Your Guide to SAP’s Modern Development Model
Nice