Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing External Data →  ABAP Database Access →  ABAP and SAP HANA 

ABAP-Specific Session Variables in SAP HANA

Session variables are global variables in the SAP HANA database. They can be read there with the built-in function SESSION_CONTEXT and provided with a value by the statement SET 'VAR' = :value; (SAP HANA Platform SPS12 and higher). Session variables contain global information about the current context and are hence similar to ABAP system fields. In particular, their value should only be changed in exceptional application logic cases, for example, in SQLScript.

When a SAP HANA database is used as the standard AS ABAP database, the following session variables are filled with ABAP-specific values in ABAP reads:

  • CLIENT contains the current client in accordance with the nominal value of the ABAP system field sy-mandt.
  • CDS_CLIENT like CLIENT but with the following differences:
  • CDS_CLIENT is set to the specified value when the database is accessed with an ABAP SQL statement with the addition USING CLIENT.
  • APPLICATIONUSER contains the current client in accordance with the nominal value of the ABAP system field sy-uname.
  • SAP_SYSTEM_DATE contains the current system date of the AS ABAP in accordance with the nominal value of ABAP system field sy-datum.

Other versions: 7.31 | 7.40 | 7.54


  • The ABAP-specific session variables can be read, for example, in AMDP methods and make the associated input parameters superfluous. Such a method should only be called up from ABAP programs. Otherwise it cannot be guaranteed that the variables will be provided with the correct values. However, write access to session variables with SQLScript statement SET is not permitted in AMDP methods.

  • In the CDS DDL of the ABAP CDS, the syntax $session.vname can be used in the definition of a CDS view to access the ABAP-specific session variables. The name vname is then different from the name shown here. The CDS session variable client accesses CDS_CLIENT, not CLIENT. When a CDS view is accessed using ABAP SQL, the session variables are available on all supported database platforms and not just on the SAP HANA database.

  • In ABAP reads, regardless of whether they are in ABAP SQL, Native SQL, or AMDP, the session variable LOCALE_SAP contains the current value of the text environment language, which can be set by the statement SET LOCALE LANGUAGE.


Reads the session variable APPLICATIONUSER using ADBC.

DATA(result) = NEW cl_sql_statement( )->execute_query( 

DATA uname TYPE sy-uname. 
result->set_param( REF #( uname ) ). 
result->next( ). 
cl_demo_output=>display( uname ).

Executable Example

The example SAP HANA, ABAP-Specific Session Variables shows various ways of accessing the session variables specified here.