Skip to Content

CURRENT_USER in Triggers - HANA DB

Hi Experts,

I have created several triggers and they are based on the SAP ERP Tables in the SAPABAP1 schema. Now these triggers write to some copy tables of the original SAP ERP Tables + the CURRENT_USER column that is based on the HANA current_user function. The issue that I have is that when I execute an operation in the SAP ERP, I expect from the trigger in the SAP HANA that the user that has executed the transaction in the SAP is written to the copy table where the trigger writes the data. In fact, it writes in the copy table in the CURRENT_USER field, not the one who performs the operation in SAP ERP, but the one that has initially created the trigger table in SAP HANA.

Do you have any suggestion how can I make possible to capture in my trigger-tables the user that perform the operation in the SAP ERP?

Thanks

Regys

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Feb 18, 2019 at 03:28 PM

    Hi Regys,

    According to my understanding function SESSION_CONTEXT('APPLICATIONUSER') should provide the ABAP session user.

    You will find more information in manual “SAP HANA SQL and System Views Reference” (3.8.1.149 SESSION_CONTEXT Function (Miscellaneous)):
    https://help.sap.com/doc/9b40bf74f8644b898fb07dabdd2a36ad/2.0.03/en-US/SAP_HANA_SQL_and_System_Views_Reference_en.pdf

    Best regards
    Andreas

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.