Skip to content

ABAP Keyword Documentation →  ABAP - Dictionary →  ABAP CDS in ABAP Dictionary →  ABAP CDS - Data Definitions →  ABAP CDS - DDL for Data Definitions →  ABAP CDS - parameter 

ABAP CDS - parameter_annot

Other versions: 7.31 | 7.40 | 7.54

Syntax

... @annotation ...
... @<annotation ...

Effect

Specifies an annotation annotation as a parameter annotation in the definition of an CDS parameter parameter of one of the following:

Parameter annotations can be specified before and after the parameter: The annotation should be defined as a CDS object in a CDS annotation definition and the annotation definition annotation @Scope should be specified here using the value #PARAMETER.

  • In front of the parameter, the character @ must be placed before the name annotation of the annotation.
  • Following the parameter, the characters @< must be placed before the name annotation of the annotation.

The following tables show the possible ABAP annotations that can be specified and their meanings. The ABAP annotations are evaluated by the ABAP runtime environment for every CDS entity. Annotations with other identifiers are usually framework-specific annotations. These are not evaluated by the ABAP runtime environment but by other SAP frameworks instead.

The first column of the table displays the (possibly structured) name annotation of an ABAP annotation and the second column displays its meaning. The third column shows the possible annotation values. The fourth column shows the value set implicitly for the annotation value if the annotation is not used explicitly. The fifth column displays the default value set implicitly for value in accordance with the annotation definition if the annotation is specified without a value. If nothing is specified for the annotation value, the annotation should be specified without a value.

EndUserText Annotations

Translatable texts of the parameter.

Annotation Meaning Annotation Values Default Value if Not Used Default Value if Used Without Value
EndUserText.label Translatable short text of the parameter Character string with maximum 60 characters - -
EndUserText.quickInfo Translatable tooltip of the parameter String - -


Note

ABAP annotations introduced using EndUserText are used to define translatable semantic texts for a CDS object. The value of an annotation like this is saved in special tables that have a language key and that are translatable. The value specified in the source code should consist of text in the original language of the CDS source code and is translated into the required languages. The methods of the class CL_DD_DDL_ANNOTATION_SERVICE read these texts as specified by an input parameter for the language. If no language is passed to the input parameter, the text environment language is used as the default. If no text is found for the language, the secondary language in AS ABAP is used.

Environment Annotations

Defines parameter passing to a CDS view.

Annotation Meaning Annotation Values Default Value if Not Used Default Value if Used Without Value
Environment.systemField Assigns an ABAP system field to the input parameter for implicit parameter passing in ABAP SQL. #CLIENT:
sy-mandt
#SYSTEM_DATE:
sy-datum
#SYSTEM_TIME:
sy-uzeit
#SYSTEM_LANGUAGE:
sy-langu
#USER:
sy-uname
- -

An input parameter can be annotated strictly once with the annotation Environment.systemField. If the CDS entity is used as a data source of a SELECT statement in ABAP SQL, this assignment has the following consequences:

  • No explicit actual parameter can be assigned to an input parameter to which the system field sy-mandt was assigned using #CLIENT. ABAP SQL always passes (implicitly) the ID of the current client in accordance with the nominal value of sy-mandt or from the clients specified using USING CLIENT. The obsolete addition CLIENT SPECIFIED cannot be specified when a CDS entity of this type is accessed.
  • An explicit actual parameter does not need to be assigned to an input parameter to which a system field other than sy-mandt is assigned using #SYSTEM_.... If no explicit actual parameter is specified, ABAP SQL passes the nominal value of the assigned system field implicitly.

Any other values for value are ignored using an exception. Instead of the value #USER, the value #APPLICATION_USER can be specified too. This is, however, only offered for reasons of downward compatibility.


Notes

  • The annotation @Environment.systemField is ignored in parameter passing to the CDS entity in other CDS entities. Explicit actual parameters must be specified here, for example input parameters from the current entity or even session variables.

  • The value #CLIENT of the annotation @Environment.systemField is particularly significant for client-specific CDS table functions. If an input parameter is annotated accordingly, it is given the current client ID implicitly by the ABAP SQL statement SELECT and can be used to restrict the results set in the platform-dependent implementation of the function. @Environment.systemField: #CLIENT cannot be specified in the case of cross-client CDS table functions.

Example

The following CDS view associates all input parameters with ABAP system fields and the SELECT list consists only of the input parameters. The ABAP program DEMO_CDS_SYSTEM_FIELDS accesses the CDS view by specifying parameters in full implicitly and explicitly and produces both results.

@AbapCatalog.sqlViewName: 'DEMO_CDS_SYST'
@AccessControl.authorizationCheck: #NOT_REQUIRED
define view demo_cds_system_fields
with parameters
@Environment.systemField : #CLIENT
p_mandt : syst_mandt,
@Environment.systemField : #SYSTEM_DATE
p_datum : syst_datum,
@Environment.systemField : #SYSTEM_TIME
p_uzeit : syst_uzeit,
p_langu : syst_langu @<Environment.systemField : #SYSTEM_LANGUAGE,
p_uname : syst_uname @<Environment.systemField : #USER
as select from
demo_expressions
{
:p_mandt as client,
:p_datum as datum,
:p_uzeit as uzeit,
:p_langu as langu,
:p_uname as uname
}
where
id = '1';