How Do You Use CDS Views In ABAP?
Core Data Services (CDS) views in ABAP are a key component of SAP's modern data modelling approach, designed to optimize data access and processing in SAP systems.

Introduction
Core Data Services (CDS) views in ABAP are a key component of SAP's modern data modelling approach, designed to optimize data access and processing in SAP systems. They provide an abstraction layer over database tables, enabling efficient, declarative data operations directly at the database level. CDS views leverage SAP HANA's in-memory capabilities, ensuring high performance while simplifying data management. Widely used in Fiori and S/4HANA, they support modular, reusable, and semantically enriched data models. Refer to the SAP ABAP Course to learn more about SAP CDS views.
What Are CDS Views In ABAP?
Core Data Services (CDS) Views in ABAP are a central feature in SAP's modern data modelling approach. They simplify data access and processing in SAP systems by providing an abstraction layer over the database, enabling developers to create semantically rich, reusable, and optimized views of data. CDS views are integral to SAP’s shift towards SAP HANA, where they leverage the in-memory database capabilities.
CDS views are defined using CDS-specific SQL syntax in the ABAP Development Tools (ADT) in Eclipse. They allow the combination of multiple tables, complex calculations, aggregations, and filtering at the database level, improving performance compared to traditional ABAP logic.
Key Features of CDS Views:
· Declarative Approach: They define "what" data is needed, leaving "how" to retrieve it to the database.
· Annotations: These provide metadata to control UI behaviour, authorization, and analytical features.
· Integration with Fiori: CDS views can expose data directly to SAP Fiori apps.
· Reuse: Developers can create reusable components for modular design.
· Enhanced Performance: Pushes processing to the database, reducing load on the application server.
Example:
“@AbapCatalog.sqlViewName: 'ZC_SALES'
define view ZC_SalesView as select from sales_header
association [1..*] to sales_items as _Items on $projection.SalesOrder = _Items.SalesOrder {
key SalesOrder,
Customer,
SalesOrderDate,
_Items.Product,
_Items.Quantity
}”
CDS views modernize ABAP data modelling by enabling efficient, high-performance data access, essential for SAP HANA and S/4HANA environments. They are pivotal in building scalable and flexible SAP applications.
How Do You Use CDS Views In ABAP?
Using CDS Views in ABAP involves defining, consuming, and leveraging these views for data processing and UI integration. CDS (Core Data Services) views are created in the ABAP Development Tools (ADT) in Eclipse and offer a modern, high-performance way to access and manage data in SAP systems.
Steps to Use CDS Views in ABAP:
1. Defining the CDS View
Ø CDS views are defined using CDS-specific SQL syntax in an ABAP development environment. One can check the SAP ABAP Certification course for complete guidance.
Ø Create a new DDL (Data Definition Language) source in ADT.
Ø Use annotations to define metadata, such as database table associations, authorizations, and UI behaviour.
Example:
“@AbapCatalog.sqlViewName: 'ZC_SALES'
@AccessControl.authorizationCheck: #CHECK
define view ZC_SalesView as select from sales_order
association [1..*] to sales_items as _Items on $projection.SalesOrder = _Items.SalesOrder {
key SalesOrder,
CustomerName,
SalesDate,
_Items.Product,
_Items.Quantity
}”
2. Consuming the CDS View in ABAP
Ø CDS views can be consumed in ABAP programs using the SELECT statement.
Ø Syntax allows direct access to the view like a database table.
Example in ABAP:
“DATA: lt_sales TYPE TABLE OF zc_salesview.
SELECT * FROM zc_salesview INTO TABLE lt_sales WHERE SalesDate = '20231201'.
LOOP AT lt_sales INTO DATA (ls_sales).
WRITE: / ls_sales-SalesOrder, ls_sales-CustomerName.
ENDLOOP.”
3. Exposing CDS Views to Other Layers
Ø CDS views can be exposed as OData services for UI5 or Fiori apps.
Ø Use the annotation @OData.publish: true to enable OData publishing.
CDS views streamline data modelling and enhance performance by executing complex data operations at the database level. They are essential for SAP HANA and Fiori-based application development, allowing seamless integration across SAP’s ecosystem. Various courses on SAP ABAP or SAP FICO Online Course helps one learn more about CDS vies in SAP.
Conclusion
CDS views in ABAP provide a powerful way to model and access data efficiently, leveraging SAP HANA's in-memory capabilities. They enhance performance, ensure reusability, and integrate seamlessly with Fiori and OData services. CDS views simplify data handling and support modern SAP application development by pushing processing to the database. For expert guidance, consider enrolling in an SAP ABAP Training Institute in Delhi to master these advanced concepts.
FAQs
1. What are CDS views used for in ABAP?
CDS views are used for efficient data modelling, combining multiple tables, performing aggregations, and exposing data for SAP Fiori and OData services.
2. Can CDS views improve performance?
Yes, CDS views execute complex data operations at the database level, leveraging SAP HANA’s in-memory capabilities to enhance performance and reduce application server load.
3. How are CDS views integrated with Fiori?
CDS views integrate with Fiori using annotations like @OData.publish: true, enabling them to expose data as OData services for Fiori applications.
What's Your Reaction?






