Skip to Content

Expose a Standard Core Data Service for ABAP Environment

Requires Customer/Partner License
Create a service definition, service binding and communication scenario to expose a Core Data Services (CDS) view in SAP Business Technology Platform ABAP Environment.
You will learn
  • How to create a service definition
  • How to create a service binding
  • How to create a communication scenario
niloofar-flothkoetterNiloofar FlothkoetterNovember 23, 2021
Created by
mervey45
September 3, 2018
Contributors
niloofar-flothkoetter
mervey45

Always replace XXX with your initials or group number.

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

  • Step 1

    You need to create an OData service by defining and binding a service based on the corresponding CDS view. As soon as the OData service is published in the local system repository, it is ready to be consumed by an OData client, such as a SAP Fiori app. To be able to use this exposed service and its related service binding, you need to create a published Communication Scenario. This published Communication Scenario will be assigned to a Communication Arrangement.

    Create ABAP package
  • Step 2
    1. In Eclipse, choose in the menu bar Help > Install New Software….

      install new software
    2. For Eclipse Photon, add the URL https://tools.hana.ondemand.com/photon and press enter to display available features. Select ABAP Development Tools and choose Next.

      choose ADT
    3. confirm the license agreements and choose Finish to start the installation. You will need to restart your Eclipse.

      license
  • Step 3

    Mark this steps as completed by pressing Done if you have already created the package Z_Package_XXX (where XXX is your group number) in the previous tutorials.

    1. Open Eclipse and connect to your system.

    2. Right click the main package ZLOCAL choose New > ABAP Package.

    3. Create your own ABAP development package Z_PACKAGE_XXX as a sub package of ZLOCAL.

      • Name: Z_PACKAGE_XXX
      • Description: my new package
    4. Click Next.

      Create ABAP package
    5. Select package properties and click Next.

      • Software Component: ZLOCAL
      Create ABAP package
    6. Select a transport request and click Finish.

      Transport request

    Add your package to Favorite Packages.

  • Step 4

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

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

      • Name: Z_DEF_XXX
      • Description: service definition
    4. Click Next.

      Create Service Definition

    The Service definition is now created.

    Created Service Definition
  • Step 5

    Exposition of the CDS view I_Currency and provide Currency as alias.
    Do not forget to save and activate!

    ABAP
    Copy
    @EndUserText.label: 'Demo service Definition'
    define service Z_DEF_XXX {
      expose I_Currency as Currency;
    }
    
  • Step 6

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

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

      • Name: Z_BIND_XXX
      • Description: service binding
      • Binding Type: ODATA V2 (UI - User Interface: Consumed in SAPUI5 Apps)
    4. Click Next.

      Create Service Binding
  • Step 7

    Click Activate, and then you will see the service name and service URL in the table.

    Publish Service Binding
  • Step 8

    After publishing the business service, you can preview the published business service as SAP Fiori Elements app in the Service Binding editor:

    1. Go to the Service Details on the right side

    2. Either double-clicking on the entity Currency or right-clicking on it and then selecting Open preview for Fiori Elements App.

      Preview Service Binding
    3. Login with your username and password.

      Login
    4. To set some filters click on settings icon.

      set Settings
    5. Select fields that shall be displayed or select all and click OK.

      select fields
    6. Click on GO.

      GO button
    7. You can see the filtered data on UI.

      UI view
  • Step 9
    1. Right click 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.

      • Name: Z_COMMU_XXX
      • Description: communication scenario
    4. Click Next.

      Create Communication Scenario
  • Step 10
    1. Open the created communication scenario and navigate to Inbound tab.

    2. Check Basic under Supported Authentication Methods.

    3. Click Add inbound service.

    4. Browse the service binding created before, Z_BIND_XXX, and select inbound service ID Z_BIND_XXX_IWSG instead, where XXX is your group number.

      Add Inbound
      Add Inbound
  • Step 11

    Navigate to the Overview tab and publish the scenario locally.

    publish
  • Step 12

    Where do you define your exposed services?

Back to top