Core Data Services (CDS): The Foundation of Data Modeling

At the core of the SAP RAP model is Core Data Services (CDS), a powerful tool that simplifies how developers work with data. Instead of getting tangled in complex database tables and schemas, CDS converts these technical details into models that are easier to understand and work with from a business perspective. By abstracting away the complexities of the database, CDS makes it simpler to define, manage, and query data..

The SAP RAP model is built around three main layers of CDS, each designed to work together and create a smooth development process:

1. Behavior Definitions: Embedding Business Logic

Behavior Definitions in SAP RAP provide a mechanism for embedding business logic directly within the data model, leveraging the declarative power of CDS views. This approach eliminates the need for managing business rules separately by associating behavior logic, such as validations, determinations, and actions, with the entities themselves. Behavior Definitions can be classified as Managed or Unmanaged, depending on the level of control required.

Managed vs Unmanaged Behavior Definitions in SAP RAP

Managed Behavior Definitions in SAP RAP are fully controlled by the SAP Fiori and SAP Cloud Platform frameworks. In this approach, core operations such as CRUD (Create, Read, Update, Delete) and transaction management are automatically handled by the framework, significantly reducing the need for developers to manually implement these tasks. This allows developers to focus on defining business logic, while SAP takes care of the underlying infrastructure and ensures consistent, error-free execution of standard operations.

Unmanaged Behavior Definitions, on the other hand, offer developers greater flexibility and control over how business logic is implemented. In this model, the system does not automatically manage CRUD operations or transaction handling. Developers must manually define the behavior for each operation (Create, Read, Update, Delete) and explicitly control the transaction lifecycle. This level of control allows for more granular customization, enabling developers to create complex data manipulations, implement sophisticated business rules, and design tailored transaction flows that meet specific application requirements. However, it also places the responsibility for ensuring data integrity, consistency, and performance squarely on the developer’s shoulders.

Types of Business Logic Managed by Behavior Definitions

CRUD Operations
Behavior definitions manage the core CRUD operations on entities. These definitions ensure that when an entity is created or updated, the corresponding data is correctly inserted, modified, or deleted in the database. They maintain the integrity of the entity’s state throughout the operation, handling both data validation and transaction boundaries.

Validations
Validation logic in behavior definitions within SAP RAP ensures strict compliance with business rules and maintains data integrity by verifying that input data meets predefined constraints. Acting as essential checkpoints during operations like Create and Update, validations enforce conditions that must be satisfied for the operation to proceed. This mechanism prevents invalid transactions, upholding the consistency and reliability of the underlying data model.

Determinations
Determinations in behavior definitions are a critical aspect of SAP RAP, enabling the dynamic derivation or modification of entity attributes during specific operations. These logic routines are triggered by predefined conditions, such as updates to related fields or the execution of create, update, or delete operations. Determinations ensure that dependent fields are automatically computed or adjusted in real time, maintaining consistency and alignment with business rules.

User-Defined Actions Behavior definitions in SAP RAP enable the definition of custom actions that are directly triggered by user interactions. These actions can be seamlessly integrated into the user interface, often linked to buttons, allowing users to execute predefined operations with a single click. Actions are versatile, capable of performing complex calculations or executing specific business logic, providing a dynamic and interactive experience aligned with business requirements.

2. Data Definition Layer

The Data Definition Layer establishes the structural foundation of an application’s data model. Using CDS, developers define entities such as database tables and views, specifying their attributes, primary keys, data types, and associations. This layer transforms raw database structures into business-relevant models by enriching them with semantic meaning and defining relationships between entities.

Types of Data Definitions in the Data Definition Layer

Entity Definitions                                                                              Entity definitions are the core of the Data Definition Layer in SAP RAP, modeled using CDS. They define the structure of business entities by specifying attributes, their data types, primary keys, constraints, and relationships, transforming raw database tables into semantic, reusable models. Attributes are explicitly defined with precise data types to ensure accurate representation of business data, while primary keys enforce uniqueness, enabling robust entity relationships and associations.

Projection Views                                                                        Projection views in the Data Definition Layer of SAP RAP are specialized CDS artifacts that provide streamlined representations of underlying entities. They expose a selective subset of fields from one or more data entities, tailoring the data structure to specific application. By limiting the scope of visible fields, projection views reduce data model complexity and enhance efficiency for targeted use cases. These views also support the inclusion of metadata and behavior annotations, enabling enriched field definitions

Analytical Views                                                                          Analytical views in the Data Definition Layer of SAP RAP are specifically designed to meet the needs of reporting and business intelligence. These views structure data using measures, dimensions, and hierarchies, which are essential for performing complex analytical operations. They support aggregation, filtering, and calculated measures, enabling advanced data analysis and processing. By leveraging OLAP-like operations, analytical views allow for multidimensional exploration of data, making them ideal for analyzing and reporting across various dimensions and hierarchies. This structure enhances the ability to derive meaningful insights from large datasets, optimizing the performance of analytical queries and reporting processes.

Extend View                                                                                Extended Views are a method for augmenting existing CDS views by adding custom fields, logic, or annotations, all without altering the original data model. Using the extend keyword, developers create a new view that enhances an existing one, allowing the addition of new attributes, calculations, or business-specific logic. Extended views ensure that modifications are contained, maintaining the integrity and upgradeability of the base model.

3. Metadata Extensions

Metadata extensions in SAP RAP provide a mechanism to customize or enhance existing data models without altering the original CDS definitions. These extensions allow developers to add custom annotations, fields, or additional metadata to enrich the data model, tailoring it to specific business requirements. The purpose of metadata extensions is to enable the customization of standard entities, such as adding localization support, UI-specific annotations, or new validation rules while preserving the integrity of the core data model.

Conclusion

Whether implementing Managed or Unmanaged Behavior Definitions to tailor business logic or designing complex data models in the Data Definition Layer, CDS provides developers with the tools to meet diverse and evolving business requirements. Its flexibility ensures seamless integration of business rules with data structures while maintaining high standards of consistency and performance. As more organizations adopt SAP RAP to streamline and future-proof their applications, CDS stands out as an essential foundation, enabling the development of intelligent, scalable, and data-driven solutions that align with the demands of the modern digital landscape.

Core Data Services (CDS): The Foundation of Data Modeling
Recente Posts

Stay tuned about the lastest innovations?

And stay tuned for the latest events