Skip to Content
avatar image
Former Member

Getting logged in user

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)?



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Dec 27, 2014 at 07:30 AM

    Hello Nitya,

    You get the current logged in user as :


    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.



    Add comment
    10|10000 characters needed characters exceeded

    • 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,