Ansicht
Dokumentation

ABENCDS_LANGUAGE_ELEMENTS - CDS LANGUAGE ELEMENTS

ABENCDS_LANGUAGE_ELEMENTS - CDS LANGUAGE ELEMENTS

TXBHW - Original Tax Base Amount in Local Currency   BAL Application Log Documentation  
This documentation is copyright by SAP AG.
SAP E-Book

- Language Elements

The following sections summarize the language elements of the CDS DDL, CDS BDL, and CDS DCL in ABAP CDS, arranged by topics.

In addition to the language elements shown here, CDS source code can also contain annotations with metadata.

DDL

CDS Annotation Definitions

Keywords and Additions

Language Element Meaning
define annotation ... Defines a CDS annotation
enum Defines enumeration symbols of a CDS annotation
default Defines default values of a CDS annotation
array of Defines an annotation arras.

CDS Views

Keywords and Additions

Language Element Meaning
DEFINE VIEW...AS Defines a CDS DDIC-based view
DEFINE VIEW ENTITY...AS Defines a CDS view entity
DEFINE VIEW ENTITY... AS PROJECTION ON Defines a CDS projection view
DEFINE TRANSIENT VIEW ENTITY... AS PROJECTION ON Defines a CDS analytical projection view
ROOT Defines a CDS view as a root entity
PROVIDER CONTRACT TRANSACTIONAL_QUERY \lbr                  TRANSACTIONAL_INTERFACE \lbr                  ANALYTICAL_QUERY \lbr                  { } Specifies the scenario in which a CDS projection view is used.
WITH PARAMETERS Defines input parameters of a CDS view
SELECT $[DISTINCT$] ... FROM SELECT statement of a CDS view
INNER JOIN ... ON Inner join in a SELECT statement
LEFT$|RIGHT OUTER JOIN ... ON Outer join in a SELECT statement
ASSOCIATION ... TO ... AS ... ON Defines a CDS association for a path expression in a SELECT statement
REDEFINE ASSOCIATION Redefines a CDS association in a CDS projection view.
WITH DEFAULT FILTER Specifies a default filter condition of a CDS association
1: Attribute of a path expression
INNER ... WHERE Attribute of a path expression
LEFT OUTER ... WHERE Attribute of a path expression
COMPOSITION ... OF Defines a CDS composition
ASSOCIATION TO PARENT ... AS ... ON Defines a CDS to-parent association
KEY Defines an element of a SELECT list as key field
AS Defines an alias name for an element of a SELECT list
$EXTENSION.* Elements of an extension in a SELECT list (only available in CDS DDIC-based views)
$PROJECTION.* Reuses expressions defined in the SELECT list of a CDS view entity in an operand position of the SELECT list of the same CDS view entity.
WHERE ... WHERE clause of a SELECT statement
GROUP BY ... GROUP-BY clause of a SELECT statement
HAVING ... HAVING clause of a SELECT statement
EXCEPT ... EXCEPT clause of a SELECT statement, currently only available for CDS view entities.
INTERSECT ... INTERSECT clause of a SELECT statement, currently only available for CDS view entities.
UNION $[ALL$] ... UNION clause of a SELECT statement
VIRTUAL Defines a new element of a CDS projection view
LOCALIZED Defines the cardinality of a text association
REDIRECTED TO Redirects a CDS association in a CDS projection view to a projection of the association target.
REDIRECTED TO COMPOSITION CHILD Redirects a CDS composition in a CDS projection view to a projection of the composition target.
REDIRECTED TO PARENT Redirects a CDS to-parent association in a CDS projection view to a projection of the association target.

Expressions

Operators Meaning
MAX, MIN, AVG $[AS dtype$], SUM, COUNT Aggregate expression in a SELECT statement
+, -, *, / Arithmetic expression in a SELECT statement
CASE, WHEN, THEN, ELSE, END Case distinction in a SELECT statement
CAST Cast expression in a SELECT statement
=, <>, , >, =, >=, BETWEEN, LIKE, IS NULL, NOT, AND, OR Relational expression in a SELECT statement

Built-In Functions

Function Meaning
ABS, CEIL, DIV, DIVISION, FLOOR, MOD, ROUND Numeric function in a SELECT statement
CONCAT, CONCAT_WITH_SPACE, INSTR, LEFT, LENGTH, LPAD, LOWER, LTRIM, REPLACE, RIGHT, RPAD, RTRIM, SUBSTRING, UPPER String function in a SELECT statement
BINTOHEX, HEXTOBIN Byte string function in a SELECT statement
COALESCE Coalesce function in a SELECT statement
FLTP_TO_DEC, UNIT_CONVERSION, CURRENCY_CONVERSION, DECIMAL_SHIFT, GET_NUMERIC_VALUE, CURR_TO_DECFLOAT_AMOUNT Conversion functions in a SELECT statement
DATS_IS_VALID, DATS_DAYS_BETWEEN, DATS_ADD_DAYS, DATS_ADD_MONTHS Date function in a SELECT statement
TIMS_IS_VALID Time function in a SELECT statement
TSTMP_IS_VALID, TSTMP_CURRENT_UTCTIMESTAMP, TSTMP_SECONDS_BETWEEN, TSTMP_ADD_SECONDS Time stamp function in a SELECT statement
ABAP_SYSTEM_TIMEZONE, ABAP_USER_TIMEZONE Time zone functions in a SELECT statement
TSTMP_TO_DATS, TSTMP_TO_TIMS, TSTMP_TO_DST, DATS_TIMS_TO_TSTMP Date/time conversions functions in a SELECT statement

CDS Entity Extensions

Keywords and Additions

Language Element Meaning
EXTEND VIEW ENTITY...WITH Extends a CDS view entity or a CDS projection view using a CDS view entity extension
EXTEND CUSTOM ENTITY...WITH Extends a CDS custom entity using a CDS custom entity extension
EXTEND ABSTRACT ENTITY...WITH Extends a CDS abstract entity using a CDS abstract entity extension
EXTEND VIEW ...WITH Extends a CDS view using a CDS view extension

CDS Table Functions

Keywords and Additions

Language Element Meaning
DEFINE TABLE FUNCTION ... RETURNS ... IMPLEMENTED BY METHOD ... Defines a CDS table function

CDS Hierarchies

Keywords and Additions

Language Element Meaning
DEFINE HIERARCHY ... Defines a CDS hierarchy
WITH PARAMETERS Defines input parameters of a CDS hierarchy
AS PARENT CHILD HIERARCHY Defines a CDS hierarchy using parent-child relationships
SOURCE ... Specifies the data source of a CDS hierarchy
CHILD TO PARENT ASSOCIATION Specifies the hierarchy association of a CDS hierarchy
PERIOD FROM ... TO ... VALID FROM ... TO ... Defines a temporal hierarchy
DIRECTORY ... FILTER BY ... Specifies a condition for the source of a CDS hierarchy
START WHERE ... Specifies the start condition of a CDS hierarchy
SIBLINGS ORDER BY ... Specifies the sort order of sibling nodes in a CDS hierarchy
DEPTH ... Delimits the hierarchy levels of a CDS hierarchy
NODETYPE ... Defines an element as a node type for a CDS hierarchy
MULTIPLE PARENTS ... Defines the behavior that applies if multiple parent nodes are specified in a CDS hierarchy
ORPHANS ... Defines the behavior that applies if orphan nodes are specified in a CDS hierarchy
CYCLES ... Defines the behavior that applies if node cycles are specified in a CDS hierarchy
GENERATE SPANTREE Reduces a CDS hierarchy to a tree

CDS Custom Entities

Keywords and Additions

Language Element Meaning
DEFINE CUSTOM ENTITY ... Defines a CDS custom entity
ROOT Defines a CDS custom entity as a root entity
WITH PARAMETERS Defines input parameters of a CDS custom entity
ASSOCIATION ... TO ...ON Defines a CDS association in the element list of a CDS custom entity.
WITH DEFAULT FILTER Specifies a default filter condition of a CDS association
COMPOSITION ... OF Defines a CDS composition in the element list of a CDS custom entity
ASSOCIATION TO PARENT ... ON Defines a CDS to-parent association in the element list of a CDS custom entity

CDS Abstract Entities

Keywords and Additions

Language Element Meaning
DEFINE ABSTRACT ENTITY ... Defines an CDS abstract entity
ROOT Defines a CDS abstract entity as a root entity
WITH PARAMETERS Defines input parameters of an CDS abstract entity.
ASSOCIATION ... TO ... ON Defines a CDS association in the element list of an CDS abstract entity
WITH DEFAULT FILTER Specifies a default filter condition of a CDS association
COMPOSITION ... OF Defines a CDS composition in the element list of a CDS abstract entity
ASSOCIATION TO PARENT ... ON Defines a CDS to-parent association in the element list of a CDS abstract entity

CDS Metadata Extensions

Keywords and Additions

Language Element Meaning
ANNOTATE ENTITY$|VIEW ... WITH Defines a CDS metadata extension for a CDS entity
VARIANT Joins a CDS metadata extension with a CDS variant
PARAMETERS Extends the annotations of the input parameters of a CDS entity

BDL

CDS Behavior Definitions

CDS Behavior Definition Header

Language Element Meaning
managed Defines a managed RAP BO
unmanaged Defines an unmanaged RAP BO
abstract Defines an abstract BDEF
projection Defines a projection RAP BO
interface Defines a RAP BO interface
implementation in class $[unique$] Class for manual method implementation
strict Enables BDEF strict mode
extensible ${ \lbr $[with validations on save$] \lbr $[with determinations on save$] \lbr $[with determinations on modify$] \lbr$} Enables BDEF extensions for the indicated entities
with draft Enables the draft concept for a RAP business object
use draft Reuse of RAP draft handling in a CDS projection BDEF.
with privileged mode disabling $[base context $[and$]$] Enables privileged access to a RAP business object
foreign entity Defines an entity which is not part of the BO structure as component for the response structures, thus enabling message mapping for other BOs.

Entity Behavior Definition

Language Element Meaning
define behavior for...alias Defines an entity behavior definition

Authorization Context Definition

Language Element Meaning
define authorization context ... \lbr $[for disable ${modify$|read$|modify,read$}$] Defines an authorization context that lists authorization objects that can be skipped when the respective authorization context is activated.
define own authorization context $[by privileged mode $[and$]$]{...} Defines an own authorization context that documents authorization objects used in the implementation of the RAP BO in question.

Entity Behavior Characteristics

Language Element Meaning
persistent table Defines a persistent database table for storing the data changes that result from transactional behavior.
draft table Defines the draft database table used to store draft data.
with additional save, with unmanaged save, and cleanup, with full data User-defined saving strategy for managed RAP BOs
etag master, etag dependent, total etag Defines an ETag field for optimistic concurrency control
use etag Reuse of ETag fields for optimistic concurrency control in a CDS projection BDEF.
lock master $[unmanaged$], lock dependent, lock:none Defines an exclusive lock that enables pessimistic concurrency control
authorization master ${ ( global ) $| ( instance ) $| ( global, instance ) $}, authorization dependent, authorization:none, authorization:update Defines an authorization concept for a business object to protect it against unauthorized access to data.
early numbering Defines unmanaged early numbering for all primary key fields of a business object entity.
late numbering Enables gapless assignment for unique keys when creating new entity instances.

Entity Behavior Body

Language Element Meaning
field ${ $[(readonly)$] \lbr       $|$[(mandatory)$] \lbr       $|$[(features:instance)$] \lbr       $|$[(mandatory:create)$] \lbr       $|$[(readonly:update)$] \lbr       $|$[(numbering:managed)$]     \lbr       $|$[(suppress)$] $} Defines field additions
field (modify) Augmentation of a CDS virtual element in a CDS projection BDEF.
group Splits the implementation-relevant parts of a business object's logic into multiple groups to allow simultaneous work.
create, update, delete Enables CRUD operations for a RAP business object.
use Reuse of RAP BO operations in a CDS projection BDEF.
association ... abbreviation ... \lbr$[with draft$] $[without response$] Enables read-by-association and create-by-association operations for associations.
$[static$]$[factory$]$[static factory$] action ... $[external$] Defines an action
$[static$] function ... $[external$] Defines a function
determine action ... $[always$] Defines a determine action that allows a RAP BO consumer to execute determinations and validations on request.
   draft action Edit \lbr$|  draft action Activate \lbr$|  draft action Discard \lbr$|  draft action Resume $[with additional implementation$] \lbr$|  draft determine action Prepare Defines a draft action in a draft-enabled scenario
parameter ... $[$self$] Defines an input parameter for an action or function
result $[selective$] [cardinality] ${ $self $| entity $} Defines an output parameter for an action or function
mapping for ... $[control ... $] $[corresponding$] $[except$] Maps field names from database tables to field names from the current data model
validation ... on save { ... } Defines a validation which is called when during the save sequence.
determination ... on save { ... } $| on modify { ... } Defines a determination which is called during the save sequence or immediately after data has been changed.
features: global, features: instance RAP BO operation addition. Can be used to define global or instance feature control for a RAP BO operation.
internal Defines a RAP BO operation as internal.
precheck Prevents illegal changes from reaching the application buffer by prechecking modify operations.
augment Augments modify requests on the projection layer in a CDS projection BDEF.

Abstract Behavior Definitions

Language Element Meaning
with hierarchy Causes the construction of a new kind of BDEF derived type. Only available in abstract BDEFs.
with control Optional addition of the define behavior statement that is only available in abstract BDEFs. Adds the %control structure to the corresponding derived type structure.
scalar entity ... field Alternative to an entity behavior definition that is only available in abstract BDEFs. Integrates a node of the CDS composition tree into the hierarchical derived type of the abstract BDEF as a scalar type.
association ... $[with hierarchy$] In an abstract BDEF, an association can be defined with the optional addition with hierarchy. This addition is available for to-parent associations and cross-BO associations to include them several times in the type structure.
deep mapping for ... $[corresponding$] $[sub$] Defines a deep mapping in an abstract BDEF.

BDEF Extensions

Keywords and Additions

This list displays special language elements for BDEF extensions. You can also use statements from CDS behavior definitions.

Language Element Meaning
extension Defines a BDEF extension.
extend behavior for Defines a RAP entity behavior extension.
extend own authorization context Extends an own authorization context.
extend determine action Extends an existing RAP BO determine action..
extend draft determine action Prepare Extends an existing draft determine action Prepare.
extend mapping for Extends an existing RAP type mapping.
extension for projection Extends a CDS projection behavior definition.
ancestor association Defines a CDS association as ancestor association. The association target must be an extension node.

DCL

CDS Roles

Keywords and Additions

Language Element Meaning
DEFINE ROLE Defines a CDS role
GRANT SELECT ON Defines an access rule in a CDS role
COMBINATION MODE OR$|AND Specifies multiple access rules for the same CDS entity
REDEFINITION Specifies the only existing access rule for the CDS entity
WHERE WHERE clause in a conditional access rule of a CDS role
AND, OR, NOT Boolean operator in a conditional access rule of a CDS role
INHERIT Defines an inherited access rule of a CDS role (obsolete)
ASPECT pfcg_auth,\lbr ASPECT user Conditions for CDS roles
PFCG_MAPPING Specifies a PFCG mapping in a PFCG condition of a CDS role
INHERIT ... FOR GRANT SELECT ON Defines an inheritance condition of a CDS role
... =$|<>$|$|>$|<=$|>=$|?=$|BETWEEN$|LIKE$|IS NULL ... Operators for literal conditions
BYPASS WHEN Specifies the condition for authorization filtering
IN SCENARIO Specifies the switchable authorization check
INHERIT CONDITIONS FROM ENTITY Defines an inheritance condition of a CDS role
INHERIT CONDITIONS FROM SUPER Defines an inheritance condition of a CDS role

CDS Access Policy

Keywords and Additions

Language Element Meaning
DEFINE ACCESSPOLICY Defines a CDS access policy
DEFINE PFCG_MAPPING ... BETWEEN ... AND ... USING ... Defines a PFCG mapping in an access policy
DEFINE ASPECT ... AS SELECT FROM ... WITH USER ELEMENT Defines a self-defined aspect as part of a CDS access policy






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

Length: 79229 Date: 20240423 Time: 194429     sap01-206 ( 503 ms )