Get Example source ABAP code based on a different SAP table
• EXTEND SERVICE ABAP_SDL_DEFINE_SERV • WITH ABAP_CDS_SD_EXT
ABAP_CDS_SDL - EXTEND SERVICE>
ABAP_SYNTAX EXTEND SERVICE name WITH { EXPOSE cds_entity1 $[AS alias1$]; $[EXPOSE cds_entity2 $[AS alias2$]; ...$] }>
What does it do? Extends an existing CDS service definition> name> using a CDS service definition extension> in the CDS SDL >. An existing CDS service definition can have one or more CDS service definition extensions.
ABAP_PREREQUISITE As a prerequisite for service definition extensions, the service definition to be extended must explicitly allow extensions. The annotation @AbapCatalog.extensibility.extensible>> must be set to true >. ABAP_PREREQ_END
Rules for a Service Definition Extension Service definition extensions can make additions to the original service definition, but they cannot modify, overwrite, or delete elements from it. The following rules apply:
CDS entities> cds_entity1>, cds_entity2>, ... can be exposed using the keyword EXPOSE>. The same rules apply as to the original service definition, see topic TITLE >.
Each exposed entity must have a unique name across the original service definition and all existing extensions. In case of naming conflicts, an alternative element alias1> must be assigned using the addition AS>.
The exposed entities cds_entity1>, cds_entity2>, ... can be entities from the original data model or extension entities. The names of the exposed entities must comply with the namespace> of the service definition extension. For example, if the name of a service definition extension starts with a Z>, each exposed entity must also have a name that starts with Z>. This can also be achieved by assigning an alias name with the addition AS>.
If exposed, each entity should be exposed only once in a service definition and any of its extensions. Even if a new alias name is assigned, a syntax check warning occurs if an entity is exposed more than once.
ABAP_RESTRICTIONS
CDS service definition extensions themselves cannot be extended.
Service definition annotations> are not supported. That means that no annotations are allowed in front of the statement EXTEND SERVICE>. ABAP_RESTR_END
ABAP_EXAMPLE_VX5 The following CDS service definition extension SRVD DEMO_CDS_EXTENSION_SD adds one further entity to the service definition SRVD DEMO_CDS_ORIGINAL_SD ABAP_EXAMPLE_END