Show TOC

Generating an OData Service Based on a Referenced Data SourceLocate this document in the navigation structure

You can generate an OData Service on the basis of the data source reference that was defined for a CDS view in an Eclipse-based IDE such as ABAP Development Tools for SAP NetWeaver.

Context

You want to define an OData model in the Gateway Service Builder (transaction SEGW).

Procedure

  1. Open your project.
  2. Select the Data Model node and choose Start of the navigation path Reference  Next navigation step Modeled Data Source Reference End of the navigation path from the context menu.

    The Referenced Data Source wizard is opened.

  3. Enter the required CDS entity name in the CDS Entity input field.
    Selection of the relevant CDS entity
    Figure 1: Selection of the relevant CDS entity
  4. Confirm your selection with Next.

    The second page of the wizard is opened. Here the entity you selected is displayed. The wizard displays the available entities and associations to be exposed.

    Note When you select an association, the target entity is automatically selected as well. If you deselect the association, you can select the target entities separately.
    Display of the entities and associations that belong to the selected CDS entity
    Figure 2: Display of the entities and associations that belong to the selected CDS entity
  5. When you choose Finish, the selected data model is displayed below in the Data Source References Node under Exposure via SADL (CDS Entity Exposures).
    Display of the selected CDS entity in the Data Source References node
    Figure 3: Display of the selected CDS entity in the Data Source References node
  6. Here you can adapt your data model or add additional CDS entities as Data Source.

    You can display the source entity, the association, and the target entity. If you want to add more levels to the model, right-click the required entity and select Add CDS Entity.

    Display associations of a CDS entity
    Figure 4: Display associations of a CDS entity
    Import additional CDS entities through an association
    Figure 5: Import additional CDS entities through an association
    Import additional CDS entity
    Figure 6: Import additional CDS entity
  7. Save and generate the runtime artifacts.
    Procedure for saving and generating runtime artifacts
    Figure 7: Procedure for saving and generating the runtime artifacts
  8. Register the service.
    Steps for registering the service
    Figure 8: Steps for registering the service
    Steps for registering the service
    Figure 9: Steps for registering the service

Results

The service is generated, registered, and ready to use. You can now build your application using this service that provides service metadata and transactional data.

[Optional:] You can also test it with the SAP Gateway client:

Steps for testing the service
Figure 10: Steps for testing the service
Steps for testing the service
Figure 11: Steps for testing the service
Steps for testing the service
Figure 12: Steps for testing the service