
A business service is created in the ABAP Development Tools (ADT). The data model and service implementation are generated together by creating a service definition and service binding.

In the area of business services, a service definition exposes CDS Views as a generic service. A service binding then marks it as a special kind of service. You can create an OData V2 or V4 service for API- or UI-usage. Service definitions and bindings are created in the ADT, the generated OData services are registered in transaction /IWFND/MAINT_SERVICE or /IWFND/V4_ADMIN respectively.
Note
For more details about developing OData V4 services in ABAP please read SAP note 2485370 – Development of OData V4 services using code based implementation.
The starting point is a CDS view in the ADT. First the CDS view is exposed in the service definition defining also the entity name. Adding the service definition to a service binding generates SAP Gateway runtime artifacts when activating the service binding. These runtime artifacts are tagged as system code and are not visible or even changeable in any ABAP editor. All read operations are generated based on SADL. After registering the service, these read operations can be tested.
Write operations can only be implemented by integrating a managed runtime. But this is then separated from publishing a CDS view as SAP Gateway service.
Create a Service Definition and Binding

Service definitions and bindings are ABAP repository objects and a substantial part of the business services. They can only be created and edited in the ADT. In the first step, the service definition just defines the name of the service. The CDS views are added later in the source code.
In the second step, the service binding refers to the service definition and sets the binding type, which are mainly communication protocols. The following binding types are supported:
Information Access (InA) to consume the service in a UI.
InA is used to connect to the SAP HANA enterprise search.
Open Date (OData) V2 to consume the service in a UI or as Web API.
Naming convention: <Name space>_UI/API_<App/API name>_02
Open Data (OData) V4 to consume the service in a UI or as Web API.
Naming convention: <Name space>_UI/API_<App/API name>_04
Structured Query Language (SQL) to consume the service as Web API.
SQL is used to connect to a database.

By exposing a CDS View in a service definition, the name of the entity set can be defined. For the entity type, "Type" is automatically appended to the entity set name.
The entity set names and navigation properties based on the associations in the CDS views are visible in the service binding on the right. For OData V2, multiple versions of a service definition can be added to a service binding visible on the left. For OData V4, multiple service definitions can be added to one service binding to allow cross-service navigation.
Publish a Service Binding

For OData V2, publishing of the local service endpoint registers the OData service in the AS ABAP of the service binding (embedded deployment). The service catalog entry is saved as a local object and can therefore not be assigned to any transport request. Publishing in ADT is meant for testing only.
Hint
You must first unpublish the local service endpoint in ADT before you can register the service and assign it to a transport request in SAP Gateway Service Maintenance.
For OData V4, activating the service binding registers a service group with the same name including all services in the SAP Gateway Backend Service Administration (/IWBEP/V4_ADMIN). The service group represents the service binding in the SAP Gateway service administration for OData V4. Changing or deleting the service binding will also change or delete the service group.
Note
It is recommended to always apply changes via the service binding, not the service group, to prevent inconsistencies.Publishing of the local service endpoint publishes the service group in the AS ABAP of the service binding (embedded deployment). The service group is saved as a local object and can therefore not be assigned to any transport request. Publishing in ADT is meant for testing only.
An OData V4 service binding can currently not be published locally using ADT if one of the following options in the Client Administration (SCC4) applies:
- The client has the client role Customizing.
Changes and transports for client specific objects are set to one of the options:
- Automatic recording of changes
- No changes allowed
If one of these options apply, the SAP Gateway Service Administration (/IWFND/V4_ADMIN) must be used to publish the service group. For more details, please read SAP Note 3101976 – Publishing OData V4 service is throwing error: Publishing of XXXXXXXXXX in Customizing client not allowed.