Ansicht
Dokumentation

ABENSRVD_DEFINE_SERVICE - SRVD DEFINE SERVICE

ABENSRVD_DEFINE_SERVICE - SRVD DEFINE SERVICE

ABAP Short Reference   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.
SAP E-Book

- DEFINE SERVICE

$[@service_annot1$]
$[@service_annot2$]
  ...
$[DEFINE$] SERVICE service
{
   EXPOSE cds_entity1 $[AS alias1$];
  $[EXPOSE cds_entity2 $[AS alias2$];$]
   ...
}


Effect

The statement DEFINE SERVICE implements a CDS service definition with the name service in CDS SDL. The name service is in the same namespace as the CDS entities defined with CDS DDL and must satisfy the appropriate naming conventions.

The service definition exposes the CDS entities cds_entity1, cds_entity2, ... for a business service. Each CDS entity is exposed using its own statement EXPOSE within the curly brackets. Each statement must be closed by a semicolon ;. At least one CDS entity must be exposed. The following CDS entities can be specified:

For each CDS entity, the addition AS can be used to specify an optional alias name alias1, alias2, ... The CDS entity is exposed under this alias name and it must be used when the business service is accessed.

In syntax checks and when the service definition is activated, the relationship between the exposed CDS entities is not verified.

The optional annotations @service_annot1, @service_annot2, ... can be specified in front of the statement DEFINE SERVICE.

Notes

  • If multiple CDS entities are exposed in a single service definition, these entities must be related semantically. For example, it is recommended that a service definition that exposes a CDS view, which itself exposes CDS associations, also exposes the association targets of these associations. Together with the root entity of a RAP business object all other CDS entities of the composition tree should also be exposed.
  • If a service definition is used in a business service, it must be linked with a RESTful protocol using a service binding. The service definition itself, however, is independent of the protocol in question and can be used with different protocols in multiple service bindings.
  • Further restrictions apply to the CDS entities in question when using a service definition in a service binding. For example, the definition must have at least one key field or the cardinalities of the CDS associations must be defined correctly.
  • No service bindings can be defined for service definitions that expose CDS abstract entities.

Example

The following service definition exposes CDS views that are related to each other under their own names by CDS associations.

Example

The following service definition exposes a CDS view under an alias name.

See Consuming Business Services.






Fill RESBD Structure from EBP Component Structure   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.

Length: 5918 Date: 20240329 Time: 124618     sap01-206 ( 73 ms )