In this part, you will create objects needed to expose your data model as an OData service.
-
Right-click your root CDS view ZC_BusinessPartner.
-
Choose New Service Definition in the popup menu.
- Enter the following details and choose Next:
- ZGEO in the Name field
- Geo Service in the Description field
-
Select your transport and then choose Next.
-
Choose the Define Service template and then choose Finish.
- Replace the code of your service definition with the one shown below:
@EndUserText.label: 'Geo Service'
define service ZGEO {
expose ZC_BusinessPartner as BusinessPartner;
expose ZC_BusinessPartnerGeo as BusinessPartnerGeo;
}
- Choose Activate.
-
Right-click your new service definition ZGEO.
-
Choose New Service Binding in the popup menu.
- Enter the following details and then choose Next:
- ZAPI_GEO_O2 in the Name field
- API Geo Service OData V2 in the Description field
- OData V2 - Web API in the Binding Type list box
-
Select your transport and choose Finish.
-
Choose Activate.
- After the service binding was activated, choose Publish.
You have created a service definition and a service binding. Now your service is ready to be consumed. But before you will add some custom business logic.