Read the model with ABAP SQL

CDS defines a reusable shape and semantics. ABAP SQL is one way for an ABAP program to consume that entity.

SELECT FROM zi_dispatch_since( p_since = @since_date )
  FIELDS dispatchorder, createdat
  INTO TABLE @DATA(orders).
DATA(result) = lines( orders ).

The parameter value is an ABAP host variable, hence the @. The target is an internal table because the query can return multiple orders.

Keep the responsibility boundaries clear

  • A database table persists records.
  • A CDS view entity models and exposes a reusable data shape, often with semantic annotations, associations, and access controls.
  • ABAP SQL reads from a data source into program data.
  • RAP exposes a business object/service contract with behavior, authorization, and transaction semantics; a CDS view alone is not automatically a complete API.

Use the simplest layer that meets the requirement. If multiple consumers need shared semantics, CDS can help. If a client must perform business operations through a supported service, use the appropriate RAP/service design rather than exposing a raw read model as if it were a transactional API.

Cloud and Classic source access

The query syntax is modern ABAP SQL. In ABAP Cloud, SAP-delivered sources must be released for the relevant use; project-owned sources must follow the package and language-version rules. Classic systems have their own compatibility and API policies. An entity name copied from this fictional lesson will not exist in your system.

Practice

Supply the parameter, select fields, collect the rows, and set result to the row count. The checker verifies structure only; it performs no SELECT.

Sources

Version note: CDS parameter syntax in a data source and the entity’s availability depend on the ABAP release and project language version.

Developer practice · ABAP

Practice: select from a project-owned view

Read the key and date from ZI_DISPATCH_SINCE, supplying the date parameter, and count the rows.

Choose your ABAP environment

This choice changes the output pattern checked here: WRITE belongs in a classic executable report, while out->write( ) uses the supplied output reference in an ABAP Cloud class-run method. It does not switch the language version of the other code; check release and API availability in your target system.

Complete the task and include the output statement shown for your selected environment. 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