Skip to Content

Expose a Standard Core Data Service for ABAP Environment

Previous

Expose a Standard Core Data Service for ABAP Environment

By Merve Yalcin

Create a service definition, service binding and communication scenario to expose CDS entities in SAP Cloud Platform ABAP environment.

Details

You will learn

  • How to create a service definition
  • How to create a service binding
  • How to create a communication scenario

In this tutorial, wherever xxx appears, use a number (e.g. 000).

Create all Business services with ABAP namespace Z....


Step 1: Create your own ABAP package
  1. Open eclipse and connect to your system.
  2. Right click on main package ZLOCAL choose New > ABAP Package.
  3. Create your own ABAP development package Z_PACKAGE_XXX as a sub package of ZLOCAL.
  4. Click Next.
    Create ABAP package
  5. Select package properties and click Next.
    Create ABAP package
Please log in to access this content.
Step 2: Select a transport request

Select a transport request and click Finish.
Transport request
Add your package to Favorite Packages.

Please log in to access this content.
Step 3: Create a service definition

We want to create service definition to expose CDS entities and their behavior.

  1. Right click on your package and choose New > Other ABAP Repository Object > Business Services > Service Definition.
  2. Click Next.
    Add Service Definition
  3. Create a service definition by adding following information.
  4. Click Next.
    Create Service Definition
Please log in to access this content.
Step 4: Add method

Add your method to your service definition.
Do not forget to save and activate!

@EndUserText.label: 'Demo service Definition'
define service Z_DEF_XXX {
  expose I_Currency as Currency;
}
Please log in to access this content.
Step 5: Create a service binding

We want to create service binding to bind service to a protocol and preview.

  1. Right click on your package and choose New > Other ABAP Repository Object > Business Services > Service Binding.
  2. Click Next.
    Add Service Binding
  3. Enter data for a new service binding. Use the service definition created in last step.
  4. Click Next.
    Create Service Binding
Please log in to access this content.
Step 6: Publish your service binding

Click Publish locally, and then you will see the service name and service URL in the table.
Publish Service Binding

Please log in to access this content.
Step 7: Create a communication scenario
  1. Right click on your package and choose New > Other ABAP Repository Object > Communication Management > Communication Scenario.
  2. Click Next.
    Add Communication Scenario
  3. Enter data for a communication scenario.
  4. Click Next.
    Create Communication Scenario
Please log in to access this content.
Step 8: Add inbound into communication scenario
  1. Open the created communication scenario and navigate to Inbound tab.
  2. Check Basic under Supported Authentication Methods and click Add inbound service. The service binding created before will be displayed in the table below.
    Add Inbound
    Add Inbound
Please log in to access this content.
Step 9: Publish communication scenario

Navigate to the Overview tab and publish the scenario locally.
publish

Please log in to access this content.
Step 10: Test yourself

Define a service definition with following information:

  • annotation: @EndUserText.label: 'Test'
  • service name: service Z_Testyourself
  • expose I_Currency as Currency
×

Updated 09/06/2018

Time to Complete

15 Min.

Beginner
Next
Back to top