Skip to Content
0

Who's the user logged in

Oct 24, 2016 at 12:17 PM

100

avatar image
Former Member

I find this query:

SELECT T0.U_NAME FROM OUSR T0 WHERE T0.INTERNAL_K = $[USER]

but when I go to save it on a user query SAP traslate the query in :

SELECT T0.U_NAME FROM OUSR T0 WHERE T0.INTERNAL_K = 1


I need the information of the user logged in SAP becouse of depending of the user I need to change a result of the user query.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
Gaurav Bali Oct 25, 2016 at 05:02 AM
1

Hi Ercole

You can use following query to get current user for your query, and then use the value in variable for your query. Also the translation will return value because value of INTERNAL_K for manager is 1. It will change according to logged in user.

Just save below query in query manager and execute query via Tools>Queries>User queries

declare @User as nvarchar(50)
set @User =(SELECT T0.U_NAME FROM OUSR T0 WHERE T0.INTERNAL_K = $[USER])

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Oct 24, 2016 at 12:20 PM
0

You can use @variable function to get user who logged in. Use @variable('BOUSER') at universe level.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Oct 24, 2016 at 03:27 PM
0

Thank you but I have not undestand how to use the "@variable('BOUSER')" in a user query.

I try this but doesn't work : SELECT T0.U_NAME FROM OUSR T0 WHERE T0.INTERNAL_K = @variable('BOUSER')

I attached an .JPG to show you what I have done.

Thank you in advance.cattura.jpg


cattura.jpg (23.4 kB)
Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Nov 02, 2016 at 09:05 AM
0

Hello Gaurav, thank You a lot. The problem is solved exactly.

Can you say me where I can find the list of VARIABLE that I can use in user query of SAP.

Share
10 |10000 characters needed characters left characters exceeded