ABAP - Keyword Documentation →  ABAP - Reference →  Processing External Data →  ABAP Database Accesses →  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:



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.