cancel
Showing results for 
Search instead for 
Did you mean: 

Current Sap User Name

Former Member
0 Kudos

Hi Dear;

what is the sql code that get the Current Sap User Name and company (using query generator and nor SDK).

regards;

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Use the following Query


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

Note: This Query will not execute directly in Query Generator

Execution of Query:

Save this Query in 'Query Manager'.

Goto Tools -> Queries -> User Queries-> Navigate to this Query to Execute the query.

or

Assign this Query as FMS to some Fields.

Answers (3)

Answers (3)

Former Member
0 Kudos

Thank you All

the Sentense is $[User]

Former Member
0 Kudos

Hi Dany,

You can retrive the name of the current user logged in SAP B1 using the string $[USER]

USE table OUSR and fields u_name,internal_k

BR

Samir Gandhi

Former Member
0 Kudos

you may use $[USER], but it only works in a document / formated serach.It doesn't work from the query manager.

Former Member
0 Kudos

Dear Steffen;

could you write the complete sql statement please?

what i need is the following:

if the user X run the query he will get X

but the user Y get Y

regards;

Former Member
0 Kudos

here we go :



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

Former Member
0 Kudos

Say for example you want Cardcode and cardname from BP Master along with current logged in user, you can use


SELECT T1.cardcode, T1.cardname,  T0.U_NAME FROM OUSR T0, OCRD T1 WHERE 
T0.INTERNAL_K = $[User]