Skip to content

Latest commit

 

History

History
80 lines (45 loc) · 2.21 KB

File metadata and controls

80 lines (45 loc) · 2.21 KB

Expose Service

Introduction

In this part, you will create objects needed to expose your data model as an OData service.

1. Create Service Definition

  1. Right-click your root CDS view ZC_BusinessPartner.

  2. Choose New Service Definition in the popup menu.

New service definition

  1. Enter the following details and choose Next:
  • ZGEO in the Name field
  • Geo Service in the Description field

Details

  1. Select your transport and then choose Next.

  2. Choose the Define Service template and then choose Finish.

Template

  1. 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;
}
  1. Choose Activate.

Activate

2. Create Service Binding

  1. Right-click your new service definition ZGEO.

  2. Choose New Service Binding in the popup menu.

New service binding

  1. 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

Details

  1. Select your transport and choose Finish.

  2. Choose Activate.

Activate

  1. After the service binding was activated, choose Publish.

Alt text

Result

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.

Next Step

Add Geo Coordinates Logic

Reference Links