Core Data Services (CDS) views have become the preferred way to model and expose business data in SAP HANA Live and SAP S/4HANA environments. They provide a semantic layer directly on top of database tables, enabling real-time reporting and analytics.
However, business requirements often call for extending standard CDS views to add custom fields, calculations, or business logic without modifying the original SAP-delivered artifacts. This is where extending CDS views with ABAP plays a crucial role, enabling customers to tailor CDS models while preserving standard content and upgrade compatibility.
This article explores how ABAP developers can extend CDS views effectively in the SAP HANA Live context.
SAP delivers many standard CDS views as part of HANA Live or S/4HANA to cover common business scenarios. Yet, every customer environment has unique needs such as:
Direct modification of SAP standard views is not recommended as it jeopardizes support and upgrades. Extensibility via ABAP allows safe, flexible adaptations.
SAP supports extendable CDS views, marked with the keyword @Extensible: true. Customers can create extension views that add new elements or annotations.
Example:
@Extensible: true
define view Z_CDS_SalesOrder extend view SAP_Standard_SalesOrder
{
@EndUserText.label: 'Custom Field'
custom_field as CustomField
}
If the extension requires logic beyond what CDS syntax allows, ABAP code can complement CDS extensions:
You can create new CDS views on top of standard ones, joining or associating additional data.
define view Z_CDS_SalesOrder_Ext as select from SAP_Standard_SalesOrder as std
association [0..1] to Z_CustomTable as _CustomData on std.sales_order_id = _CustomData.sales_order_id
{
std.sales_order_id,
std.customer_name,
_CustomData.custom_field
}
Suppose the standard sales order CDS view lacks a specific custom status field required for reporting. The extension can be done as:
@Extensible: true
extend view SAP_Standard_SalesOrder
{
@EndUserText.label: 'Custom Status'
custom_status as CustomStatus
}
Extending CDS views with ABAP is a powerful method to customize SAP HANA Live data models while ensuring the stability and upgradability of SAP solutions. By leveraging extendable CDS views, custom logic in ABAP, and layered modeling approaches, organizations can meet unique business needs and enhance their SAP analytics and reporting capabilities.
For SAP developers and architects, mastering CDS view extensions bridges the gap between standard SAP content and tailored enterprise requirements, enabling agile, maintainable, and scalable SAP landscapes.