on 12-26-2014 6:14 AM
Hi Experts,
While implementing a scenario in SAP OPI I have a table with 20 records for 4 users (5 records per user) with username as 1 column. How to restrict the output such that each logged in user sees only his data.
What would be the best way to implement this?
Which attribute can we use to fetch the logged in user details ( SY-USER in ECC terms)?
Thanks!
Nitya.
Hello Nitya,
You get the current logged in user as :
SELECT CURRENT_USER "current user" FROM DUMMY;
Then you can use this current user to filter the table in your Context Calculation View.
So here you go :
1. Create a calculated attribute to collect the current logged in user
2. Use this attribute as filter in you context calculated view of business scenario.
Hope this helps.
Regards,
Archana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nitya,
depending on the exact context where you are requesting the currently logged in user, you should consider to the session user. HANA distinguishes between the session and the current user.
SELECT CURRENT_USER "current user" FROM DUMMY;
SELECT SESSION_USER "session user" FROM DUMMY;
There is a difference if you are within a procedure or a calc view which is created with "definer rights". In this case, the session user is the one you are looking for. Refer to the official documentation for details:
CURRENT_USER - SAP HANA SQL and System Views Reference - SAP Library
Regarding your second question how to restrict data access for specific users, you might consider the usage of Analytic Privileges. This is the conecpt in HANA to offer instance level visibility patterns on data.
Best regards,
Stefan
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.