This article offers a concise yet comprehensive overview of Abstract Entities in the context of non-standard RAP (RESTful Application Programming) Business Object (BO) operations. It highlights their purpose, advantages, and implementation strategies, emphasizing their pivotal role in enhancing modularity and flexibility in data modeling.
Purpose of Abstract Entities
Abstract Entities are CDS constructs designed to model complex input parameters for non-standard RAP BO operations, such as actions and functions.
🔹 They enable the definition of flexible, reusable structures without the need for database persistence, making them ideal for modeling parameters and decoupling them from underlying data models.
Advantages of Using Abstract Entities
-
Database Independence: Parameters modeled with Abstract Entities remain independent of database persistence, enhancing portability.
-
Reusability: Define once, reuse in multiple operations, promoting a modular and DRY approach.
-
Parameter Flexibility: Support complex, nested structures for handling sophisticated business logic.
-
Binding Flexibility: Not tied to specific BO nodes, enabling versatile integration.
-
Improved Separation of Concerns: Decouples parameter modeling from business logic, enhancing code maintainability.
Implementation Details
1️⃣ Define an Abstract Entity
Building Abstract Business Objects
-
Mark the Abstract Entity as root and use composition and association to parent to form the hierarchy.
-
Example BDEF:
Deep and Deep Table Parameters
-
Deep Parameter: Adds nested structure to
%param
, mapping to the composition relationships. -
Deep Table Parameter: Converts
%param
into a table, aligning with thetable
keyword in the action definition. -
Output parameters, however, do not support
deep
, and%param
becomes a simple structure in output.
Summary Table
Feature | Behavior |
---|---|
Database Independence | Yes |
Reusability | High |
Nested Structures | Supported |
Binding to BO Nodes | Not required |
Action Parameters | Supports deep and deep table |
Output Parameters | deep not supported |