Ansicht
Dokumentation

ABENHANA_SESSION_VARIABLES - HANA SESSION VARIABLES

ABENHANA_SESSION_VARIABLES - HANA SESSION VARIABLES

TXBHW - Original Tax Base Amount in Local Currency   Vendor Master (General Section)  
This documentation is copyright by SAP AG.
SAP E-Book

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 given a value using 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 statement with the addition USING CLIENT.

  • APPLICATIONUSER contains the current user name 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.

Notes

  • The ABAP-specific session variables can be read, for example, in AMDP methods and make the corresponding 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, writes to session variables with the SQLScript statement SET are not allowed 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 entity or a 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 , 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 , 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.

Example

Reading of the session variable APPLICATIONUSER using ADBC.

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






RFUMSV00 - Advance Return for Tax on Sales/Purchases   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.

Length: 6731 Date: 20240419 Time: 213434     sap01-206 ( 107 ms )