cancel
Showing results for 
Search instead for 
Did you mean: 

New Calculated Column in a CV to derive System Information like Client(100,200 etc) & Host

0 Kudos

Hi,

Can anyone help me to derive Calculated Column in a CV to derive System Information like Client(100,200 etc) , Host,Instance,Port etc.

Please suggest if any predefined functions exist in SAP HANA to consume in Calculated Columns.

Regards,

Charles G K

Accepted Solutions (0)

Answers (1)

Answers (1)

lbreddemann
Active Contributor
0 Kudos

And the use case here is...?

Besides, what documentation did you check that left you with these open questions?

0 Kudos

Hi Lars,

I want to create a calculated column where my calculations are based upon client id & system lets say if I can able to find client id like 800 need to do some calculations and if some else client so other set of calculation logic.

I had gone through system tables like M_CONNECTIONS where in I got the host details but couldnt able to find Client ID.

So looking to find functions for Client ID and host details so I can use in expressions in Graphical CV rather than scripted CV.

Regards,

Charles

lbreddemann
Active Contributor
0 Kudos

First off: the calculated column feature doesn't support this.

On a more general note: in my view, what you're trying to do here is wrong.

"client" is a concept of the SAP NetWeaver world. In NetWeaver, functionality and behaviour are not tied to tables. Instead tables are just data structures on the database level.

There the concept of "client" doesn't exist and therefore the NetWeaver database interface always makes up the relevant code for consistently implementing this concept (e.g. by automatically filtering data).

From what you described, I understand that you want to implement this concept now on the SAP HANA level. This obviously is possible, to some degree, by the means of SQL Script code.

One option here is to have your code only work on data that belongs to a specific client.

Another option is to retrieve the current session's client assignment (via SESSION_CONTEXT) and branch into the appropriate coding based on the result.

With a generated column, you define a piece of a data structure that automatically generates values based on other columns, which can be very useful in some cases. (in the majority of cases, however, I'd say the same caveats about "automagical" behaviour in databases applies for the generated columns as it does for triggers).

However, the meaning of any column should be the same for all entries of a table. By providing different implementations for the same column, you introduce different meaning for the same column and a lot of inexplicable "magic".

This is a maintenance nightmare in the making.

Depending on your use case, I'd highly recommend to change the level where you abstract the different implementations per client onto a much higher level, preferably to the ABAP layer (as the client concept is built-in there).

anindya_bose
Active Contributor
0 Kudos

One approach might work for you .

Input Parameter can be based on SQL Procedure . You can write a SQL Procedure to derive Session Client  and then use the Input Parameter to have client specific calculation .

But, I have a doubt here.  For my user id, nothing is set in "Session Client" . Still, if  I choose "Session Client" in my Calculation view, I get data. That means, system somehow know what my session is .

If I use this statement, I get two client ( 000,100)


Select  DISTINCT "KEY" , "VALUE" from M_SESSION_CONTEXT WHERE "KEY" = 'CLIENT'

     Can you please through some light here ?

Regards

Anindya