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
- Open your project.
- Select the Data Model node and choose from the context menu.
The Referenced Data Source wizard is opened.
- Enter the required CDS entity name in the CDS Entity input
field.
Figure 1:
Selection of the relevant CDS entity
- 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.
Figure 2:
Display of the entities and associations that belong to the selected CDS
entity
- When you choose Finish, the selected data model is displayed below
in the Data Source References Node under
Exposure via SADL (CDS Entity Exposures).
Figure 3:
Display of the selected CDS entity in the Data Source References node
- 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.
Figure 4:
Display associations of a CDS entity
Figure 5:
Import additional CDS entities through an association
Figure 6:
Import additional CDS entity
- Save and generate the runtime artifacts.
Figure 7:
Procedure for saving and generating the runtime artifacts
- Register the service.
Figure 8:
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:
Figure 10:
Steps for testing the service
Figure 11:
Steps for testing the service
Figure 12:
Steps for testing the service