Put a reusable read model between a table and its consumers
Several consumers need a consistent view of open dispatch orders. A CDS view entity lets a team define a reusable data model with selected fields and semantics instead of repeating a raw table projection everywhere.
Read the basic DDL shape
@EndUserText.label: 'Open dispatch orders'
define view entity ZI_OPEN_DISPATCH
as select from zdispatch_order
{
key dispatch_order as DispatchOrder,
status as Status
}
The DDL source names the entity and its data source. The projection lists exposed elements; key marks the model’s key element(s). This example is intentionally small and project-owned. zdispatch_order is fictional—not an SAP table.
View entity is not the same as a database table
A CDS view entity describes a modeled query and its semantics. It is not a physical table into which an application inserts rows. ABAP SQL can read from a CDS entity; persistence and updates belong to the appropriate table/business-object design.
Choosing CDS or a direct SELECT
Use a direct ABAP SQL SELECT for a one-off application read with simple logic. Define a CDS entity when a data shape, semantics, relationships, or access-control behavior should be reusable across consumers. More layers are not automatically better; keep the model simple.
Practice
Write the view-entity declaration, source, and projection list. This practice checks DDL fragments; it does not activate a CDS artifact or query a database. The regular ABAP output statement does not belong inside CDS DDL, so it is intentionally omitted.
Sources
- SAP Samples, CDS View Entities
- SAP Samples, ABAP Dictionary
- SAP Help Portal, ABAP Core Data Services
Version note: View entities and supported DDL features depend on the ABAP Platform release. Classic and Cloud repositories can have different allowed data sources and tools.
Developer practice · ABAP
Practice: define a small shipment view entity
Write a project-owned CDS view entity named ZI_OPEN_DISPATCH. Select from the fictional base source and expose its key and status.
Complete the task using the syntax and structure described above. Variable names can differ if you use them consistently. This browser checker checks structure only; it does not compile or run ABAP.
0 required structures detected · 0 checks
Write your solution, then check its structure.
One possible solution
@EndUserText.label: 'Open dispatch orders'
define view entity ZI_OPEN_DISPATCH
as select from zdispatch_order
{
key dispatch_order as DispatchOrder,
status as Status
}