Show TOC

Preparing OData ServicesLocate this document in the navigation structure

You access the back-end system information using OData services. Smart templates support OData version 2 with vocabulary-based annotations.

The qualities that your service requires depend on the template you are using and how you want to use it, for example, whether it is read-only or editable. If it is editable, your service must support CRUD operations and draft document handling..

Implement additional actions that must be supported as part of your OData service. If the data is represented in a list page, $count must be supported as well as $filter (for all filterable properties).

Creating a New OData Service
The easiest way to create a new OData service in an ABAP back-end system is to establish a Core Data Services (CDS) consumption view and generate the OData service from this view (data-source driven service creation). Combined with Service Adaptation Description Language) (SADL) this provides the following advantages:
  • CRUD request handling is covered by a Business Object Processing Framework (BOPF) model that can be implicitly generated and controlled by the following annotations:
    @ObjectModel.writeEnabled: true
            @ObjectModel.writeDraftPersistance: '<BO name>' 
    
  • Locking is handled by BOPF (implicit lock with modification requests)

  • Paging is implicitly handled by SADL

  • Draft document handling is implicitly covered if @ObjectModel.writeDraftPersistance is specified. However, you must also specify annotations, as defined in the draft specification.

SADL support is integrated in the SAP Gateway Service Builder (transaction SEGW).

The following options are available:
  1. The SADL OData Exposure using CDS tooling offers the option to flag the CDS artifact with an annotation and the service creation is generated during activation of the CDS artifact. By using annotation @OData.publish.true you get an OData service generated with a 1:1 relation (each property) to your CDS view. Annotations are automatically added, as predefined in the CDS view.

  2. The SADL OData Exposure using transaction SEGW is a data source-driven approach, based on the SAP Gateway concept of referenced data sources (RDS). Here, the exposure is not necessarily 1:1 for instance, multi-level associations can be defined. Exit classes can be used to add features such as value helps or field control. Annotations are automatically added, as predefined in the CDS view.

  3. Using SADL@SEGW mapping editor in transaction SEGW. You must specify the mapping of internal elements to external properties and you can select the option to generate a mapping proposal. This provides a separate external model and internal view. A separate annotation provider can be specified in the service metadata.

These options are described in detail in Creation of SADL-based OData Service for Modeled Data Sources.

More Information:
  • For more information about the BOPF model, see the SAP Library for SAP NetWeaver at http://help.sap.com/nw75 under Start of the navigation path Development Information Next navigation step Developer's Guides Next navigation step Application Development on AS ABAP  Next navigation step SAP - BOPF Developer Guide End of the navigation path.

  • For more information about ABAP CDS development, see the SAP Library for SAP NetWeaver at http://help.sap.com/nw75 under Start of the navigation path Development Information Next navigation step Developer's Guides Next navigation step Application Development on AS ABAP  Next navigation step SAP - ABAP Programming Model for SAP Fiori Next navigation step Reference Next navigation step CDS Annotations Next navigation step UI Annotations End of the navigation path.