cancel
Showing results for 
Search instead for 
Did you mean: 

CURRENT_USER in Triggers - HANA DB

regysm21
Active Participant
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

andreas_baldauf
Active Participant

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...

Best regards
Andreas

regysm21
Active Participant
0 Kudos

Hi Andreas,

thanks a lot, this was exactly what I was looking for!! 🙂


Best Regards,

Regys

Answers (0)