HANA SQL- Session Context

light111Session Context in HANA SQL AMDP


 In recent times we have to use one of the standard interface to do some calculation but we need to pass additional data to this interface but as this is a standard interface we can’t enhance the method parameters(though it is possible to enhance it with optional parameters but the decision is not to disturb the standard interface) . Normal ABAP method we can use SET/GET technique do it but in AMDP with SQL SCRIPT its slightly different.

The below post talks about how to use SET and get by using SESSION_CONTEXT ( ) and UNSET.

Below is a class with few methods- and one AMDP procedure SET_INPUT( )- uses the SET command to put into the session.

Another AMDP Procedure – UNSET_INPUT( ) – clears the session value 

and inside GET_INFO( ) – procedure using the function SESSION_CONTEXT( ) we can get our own value. By default  few of the session parameters like CLIENT, APPLICATIONUSER, LANGU  and SYS DATE are available in a AMDP procedure and similarly we can set our own.

12

Test Report Program .. 

3

The value is read using SESSION_CONTEXT( ) and passing its ID.

5

Here is the O/P->

4


 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s