Show TOC

Generate Service Artifacts From a CDS ViewLocate this document in the navigation structure

Now we want to expose the newly developed data model to OData as a canonical OData service using the so-called auto exposure approach. In this step, you will use the CDS tools as part of the ABAP development environment to generate all artifacts that are required for service activation in the SAP Gateway hub.


The following rules need to be fulfilled for a CDS view:

  • The CDS view is defined and the source code of the corresponding DDL source is syntactically correct.
  • At least one KEY element is defined in the SELECT list of the CDS view. Otherwise, the OData service generation will fail due to missing KEY elements in the CDS view.
  • The name of the CDS view in question does not exceed the maximum length of 26 characters.
    Tip If this is not the case, use the refactoring function for renaming.


  1. In the ABAP Development Tools, open the editor with the relevant DDL source where your CDS view is defined.
  2. In DDL source editor, navigate to the source code line before the DEFINE VIEW statement.
  3. Insert the following OData annotation to the CDS view:
      @OData.publish: true
    When editing the annotation, you can avail of the content assistant functionality
  4. Save the new editor content and activate the DDL source.


ABAP Development Tools delegates the activation request to the SADL (Service Adaptation Description Language) framework. SADL, in turn, generates several Gateway artifacts that are stored in the back end of the application server AS ABAP and are required for OData service activation in the SAP Gateway hub later on:

  • The actual service artifact with the technical name <CDS_VIEW>_CDS. You can find it as SAP Gateway Business Suite Enablement - Service object (object type: R3TR IWSV)
  • An SAP Gateway model (object type: R3TR IWMO) with the name <CDS_VIEW>_CDS
  • An ABAP class CL_<CDS_VIEW> that is used to provide model metadata to the SAP Gateway service.

All generated service artifacts are automatically added to the same ABAP package (and also to the same transport request) as the underlying CDS view.

Note We recommend that you do not change the generated service artifacts.

The decorator within the editor ruler indicates a successful generation process. If you move the cursor over the decorator, an info screen informs you that the service must be activated in the Gateway hub for exposure. This will be done in a separate step using the transaction /IWFND/MAINT_SERVICE.

More on this: Activate OData Service in the SAP Gateway Hub
Quick info after a successful generation of service artifacts
Figure 1: Quick info after a successful generation of service artifacts