SAP CDS F1 CUSTOM QUERY



Get Example source ABAP code based on a different SAP table
  



ABAP_CDS_DDL - DEFINE CUSTOM ENTITY, ABAP Class

ABAP_SYNTAX
... @ObjectModel.query.implementedBy : 'ABAP:class_name' ...

What does it do?
The annotation @ObjectModel.query.implementedBy binds an ABAP class class_name as a query provider class to a CDS custom entity. When a CDS custom query is accessed via a framework, such as the RAP query engine, the annotation is evaluated and the ABAP implementation is called to perform the query. The ABAP class must implement the predefined ABAP interface IF_RAP_QUERY_PROVIDER to connect it to the RAP query engine.
In the context of the ABAP RESTful Application Programming Model, CDS custom queries are referred to as RAP unmanaged queries.
For more information, see the ABAP RESTful Application Programming Model Developer guide, section Implementing an Unmanaged Query.
The annotation ObjectModel.query.implementedBy is mandatory for CDS custom entities when working in ABAP_SAP_BTP_ENV or ABAP_S4_CLOUD_ENV .



Latest notes:

While the annotation ObjectModel.query.implementedBy must be used for CDS custom entities in order to bind an ABAP class, it also can be used for other CDS entities. Then it overrides the original query of an CDS entity when accessed by a framework that evaluates the annotation.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
The custom entity DEMO_CDS_CUSTOM_ENTITY is bound to ABAP class CL_DEMO_CUSTOM_ENTITY_QUERY. This ABAP class implements the interface IF_RAP_QUERY_PROVIDER and it generates an internal table with random UUID values.
DDLS DEMO_CDS_CUSTOM_ENTITY
ABAP_EXAMPLE_END

ABAP_EXAMPLE_ABEXA
The executable example Implementing a custom query executes the query implementation class and returns data.
ABAP_EXAMPLE_END