Ansicht
Dokumentation
ABENCDS_SESSION_VAR_BUILTIN_V2 - CDS SESSION VAR BUILTIN V2
PERFORM Short Reference CPI1466 during BackupThis documentation is copyright by SAP AG.
- CDS View Entity, Built-In Session Variables
... $session.vname ...
Effect
Specifies a built-in session variable vname in an operand position in a SELECT statement of a CDS view entity. The variable must be prefixed by $session..
Session variables have a predefined name and provide context-dependent information. The following built-in session variables exist:
vname | Value when accessed |
user | Current user name, nominal value of the ABAP system field sy-uname. The returned value has the data type CHAR. |
client | Current client. The default value is the nominal value of the ABAP system field sy-mandt. In reads with an statement with the addition USING CLIENT and in calls of an AMDP method from ABAP in whose declaration the addition AMDP OPTIONS CDS SESSION CLIENT is specified, it is the value specified here. The returned value has the data type CLNT, length 3. |
system_language | Text environment language of the current internal session, nominal value of the ABAP system field sy-langu. The returned value has the data type LANG, length 1. |
system_date | Current system date of the AS ABAP, nominal value of the ABAP system field sy-datum. The returned value is of data type DATS, length 8. |
user_timezone | User time zone, nominal value of the ABAP system field sy-zonlo. The returned value has the data type CHAR, length 6. |
user_date | Current user date, nominal value of the ABAP system field sy-datlo. The returned value is of data type DATS, length 8. |
Notes
- From a technical perspective, session variables indicate global variables of the current database that are set to their value when the CDS view entity is used in . If is not used to access a CDS view entity with session variables, the content of the variables is undefined (with the exception of the SAP HANA database).
- On an SAP HANA database used as a standard AS ABAP database, the ABAP-specific session variables are called APPLICATIONUSER, CDS_CLIENT, LOCALE_SAP, and SAP_SYSTEM_DATE. They exist and are set independently of ABAP CDS and . They can be accessed using the database function SESSION_CONTEXT.
- A further ABAP-specific session variable CLIENT in the SAP HANA database always contains the current client of the ABAP session and is not modified by the addition USING CLIENT or by ABAP calls of an AMDP method in whose declaration the addition AMDP OPTIONS CDS SESSION CLIENT is specified. The HANA session variable CLIENT does not have a corresponding variable in ABAP CDS.
- For input parameters of CDS view entities annotated with the annotation environment.systemField, automatically passes the values of the session variables. It is generally preferable to use this type of local input parameter.
- In existing CDS view entities without corresponding input parameters, session variables can be passed to the input parameters of CDS view entities or CDS table functions used there.
- In CDS view entities, client handling takes place implicitly by using the session variable client.
Example
The following CDS view entity contains all possible session variables in the SELECT list. The program DEMO_CDS_SESSION_VARIABLES_VE uses to access the view entity. The program asks you of you want to use the addition USING CLIENT.
Example
The following CDS view entity DEMO_CDS_SELECT_T100_VE accesses the CDS view entity DEMO_CDS_SELECT_T100_LANGU_VE, which contains a language input parameter to which the annotation environment.systemField with the value system_language is assigned. Unlike in , there is no implicit pass of the actual parameter to the input parameter here and the corresponding session variable $session.system_language is passed instead. The program DEMO_CDS_T100_VE uses to access both view entities and the result is identical. When DEMO_CDS_SELECT_T100_LANGU_VE is accessed, the value of the system field sy-langu is passed implicitly to the input parameter. When DEMO_CDS_SELECT_T100 is accessed, the session variable $session.system_language is filled with this value.
General Material Data Addresses (Business Address Services)
This documentation is copyright by SAP AG.
Length: 9711 Date: 20240511 Time: 141801 sap01-206 ( 111 ms )