---
parser: v2
auto_validation: true
primary_tag: products>sap-btp--abap-environment
<<<<<<< HEAD
tags: [  tutorial>beginner, programming-tool>abap-development, products>sap-business-technology-platform, tutorial>license ]
=======
tags: [  tutorial>beginner, programming-tool>abap-development, products>sap-business-technology-platform, tutorial>license, software-product-function>s-4hana-cloud-abap-environment ]
>>>>>>> 59f95048a11e62962d5c8eb49e89b6f027533a25
time: 15
author_name: Niloofar Flothkoetter
author_profile: https://github.com/niloofar-flothkoetter
slug: abap-environment-business-service-provisioning
canonical_url: https://developers.sap.com/tutorials/abap-environment-business-service-provisioning
---

# Expose a Standard Core Data Service for ABAP Environment
<!-- description --> 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

## Intro
<<<<<<< HEAD
=======
This tutorial was written for SAP BTP ABAP Environment. However, you should also be able to use it in SAP S/4HANA Cloud Environment in the same way. 

>>>>>>> 59f95048a11e62962d5c8eb49e89b6f027533a25
Always replace `XXX` with your initials or group number.

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

---

### Overview

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](https://raw.githubusercontent.com/sap-tutorials/abap-core-development/main/tutorials/abap-environment-business-service-provisioning/Picture15.png)


### Install ADT

  1. In Eclipse, choose in the menu bar **Help** > **Install New Software...**.

      ![install new software](https://raw.githubusercontent.com/sap-tutorials/abap-core-development/main/tutorials/abap-environment-business-service-provisioning/newSoftware.png)

  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](https://raw.githubusercontent.com/sap-tutorials/abap-core-development/main/tutorials/abap-environment-business-service-provisioning/ADT.png)      

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

      ![license](https://raw.githubusercontent.com/sap-tutorials/abap-core-development/main/tutorials/abap-environment-business-service-provisioning/license.png)


### Create your own ABAP package

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](https://raw.githubusercontent.com/sap-tutorials/abap-core-development/main/tutorials/abap-environment-business-service-provisioning/Picture1.png)

  5. Select package properties and click **Next**.
      - Software Component: `ZLOCAL`

      ![Create ABAP package](https://raw.githubusercontent.com/sap-tutorials/abap-core-development/main/tutorials/abap-environment-business-service-provisioning/Picture2.png)

  6. Select a transport request and click **Finish**.

      ![Transport request](https://raw.githubusercontent.com/sap-tutorials/abap-core-development/main/tutorials/abap-environment-business-service-provisioning/Picture3.png)

Add your package to **Favorite Packages**.



### Create a service definition

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](https://raw.githubusercontent.com/sap-tutorials/abap-core-development/main/tutorials/abap-environment-business-service-provisioning/Picture4.png)

  3. Create a service definition by adding following information.
      - Name: `Z_DEF_XXX`
      - Description: `service definition`

  4. Click **Next**.

      ![Create Service Definition](https://raw.githubusercontent.com/sap-tutorials/abap-core-development/main/tutorials/abap-environment-business-service-provisioning/Picture5.png)

The Service definition is now created.

![Created Service Definition](https://raw.githubusercontent.com/sap-tutorials/abap-core-development/main/tutorials/abap-environment-business-service-provisioning/Picture16.png)



### Expose CDS View

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

```ABAP
@EndUserText.label: 'Demo service Definition'
define service Z_DEF_XXX {
  expose I_Currency as Currency;
}
```



### Create a service binding

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](https://raw.githubusercontent.com/sap-tutorials/abap-core-development/main/tutorials/abap-environment-business-service-provisioning/Picture6.png)

  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](https://raw.githubusercontent.com/sap-tutorials/abap-core-development/main/tutorials/abap-environment-business-service-provisioning/Picture7.png)



### Activate your service binding

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

![Publish Service Binding](https://raw.githubusercontent.com/sap-tutorials/abap-core-development/main/tutorials/abap-environment-business-service-provisioning/Picture8a.png)



### Preview your service binding

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](https://raw.githubusercontent.com/sap-tutorials/abap-core-development/main/tutorials/abap-environment-business-service-provisioning/Picture14.png)

  3. Login with your username and password.

      ![Login](https://raw.githubusercontent.com/sap-tutorials/abap-core-development/main/tutorials/abap-environment-business-service-provisioning/Picture17.png)

  4. To set some filters click on settings icon.

      ![set Settings](https://raw.githubusercontent.com/sap-tutorials/abap-core-development/main/tutorials/abap-environment-business-service-provisioning/Picture18.png)

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

      ![select fields](https://raw.githubusercontent.com/sap-tutorials/abap-core-development/main/tutorials/abap-environment-business-service-provisioning/Picture19.png)

  6. Click on **GO**.

      ![GO button](https://raw.githubusercontent.com/sap-tutorials/abap-core-development/main/tutorials/abap-environment-business-service-provisioning/Picture21.png)

  7. You can see the filtered data on UI.

      ![UI view](https://raw.githubusercontent.com/sap-tutorials/abap-core-development/main/tutorials/abap-environment-business-service-provisioning/Picture20.png)




### Create a communication scenario

  1. Right click your package and choose **New** > **Other ABAP Repository Object** > **Communication Management** > **Communication Scenario**.

  2. Click **Next**.

     ![Add Communication Scenario](https://raw.githubusercontent.com/sap-tutorials/abap-core-development/main/tutorials/abap-environment-business-service-provisioning/Picture9.png)

  3. Enter data for a communication scenario.
      - Name: `Z_COMMU_XXX`
      - Description: `communication scenario`

  4. Click **Next**.

      ![Create Communication Scenario](https://raw.githubusercontent.com/sap-tutorials/abap-core-development/main/tutorials/abap-environment-business-service-provisioning/Picture10.png)



### Add inbound into communication scenario

 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](https://raw.githubusercontent.com/sap-tutorials/abap-core-development/main/tutorials/abap-environment-business-service-provisioning/Picture11.png)

      ![Add Inbound](https://raw.githubusercontent.com/sap-tutorials/abap-core-development/main/tutorials/abap-environment-business-service-provisioning/Picture12.png)



### Publish communication scenario

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

![publish](https://raw.githubusercontent.com/sap-tutorials/abap-core-development/main/tutorials/abap-environment-business-service-provisioning/Picture13.png)


### Test yourself





---
