Ansicht
Dokumentation

ABENCDS_SESSION_VARIABLE_V1 - CDS SESSION VARIABLE V1

ABENCDS_SESSION_VARIABLE_V1 - CDS SESSION VARIABLE V1

Vendor Master (General Section)   PERFORM Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

- DDIC-Based View, session_variable

... $session.vname ...

Effect

Specifies a session variable vname in an operand position in a SELECT statement of a . The variable must be prefixed by $session.. The prefix and the variable are case-sensitive. $session.vname, $Session.Vname, and $SESSION.VNAME can all be used. No other spellings are allowed.

Session variables have a predefined name and are set to a predefined value when the CDS view is used in . This also applies to CDS views that are used as data sources in other CDS views. The following session variables exist:

vname Value when accessed using
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, 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 has the 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 is used in . If is not used to access a CDS view with session variables, the content of the variables is undefined (with the exception of the SAP HANA database).
  • For input parameters of CDS views annotated with the special annotation environment.systemField, can pass the values of the session variables specified here automatically too. It is generally preferable to use this type of local input parameter.
  • In existing CDS views without corresponding input parameters, session variables can be passed to the input parameters of CDS views or CDS table functions used there.
  • When the statement SELECT is used to access a CDS view that uses the session client client, the addition USING CLIENT can be used and sets the value of the session variable client for the duration of the statement. The additions USING $[ALL$] CLIENTS $[IN$] plus the obsolete addition CLIENT SPECIFIED cannot be used.
  • A CDS view that accesses a session variable directly or using a view cannot usually be buffered. Only client-dependent views that access the session variable client directly can be buffered.

Example

The following CDS view contains the possible session variables in the SELECT list. The program DEMO_CDS_SESSION_VARIABLES uses to access the view and fills the session variables with the associated values. Here, it is possible to define whether USING CLIENT is used or not.

Example

The following CDS view DEMO_CDS_SELECT_T100 accesses a further CDS view DEMO_CDS_SELECT_T100_LANGU with 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 uses to access both views and the result is identical. When DEMO_CDS_SELECT_T100_LANGU 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.






rdisp/max_wprun_time - Maximum work process run time   General Data in Customer Master  
This documentation is copyright by SAP AG.

Length: 12022 Date: 20240416 Time: 235428     sap01-206 ( 167 ms )