cancel
Showing results for 
Search instead for 
Did you mean: 

How to query for user account type?

Former Member
0 Kudos

Hi Expert,

I got some validation done for AR Invoice in SBO_SP_TransactionNotification, however I will like to execute this validation only when login user is not SUPERUSER. How can I query or get information that the current user is not a SUPERUSER?

Thank you.

Rollin

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Please help!

Edited by: Rollin Snowboard on May 5, 2009 12:01 PM

Former Member
0 Kudos

Try this one:

if exists (Select T0.cardcode from oinv T0 where T0.DocEntry = @list_of_cols_val_tab_del

and T0.usersign2 not in (SELECT T0.[Internal_K\] FROM OUSR T0 where T0.superuser='Y'))

begin

SET @error = 10

SET @error_message = N'Update is not allowed'

end

Answers (4)

Answers (4)

Former Member
0 Kudos

Dear Experts,

How do I query for user account type when "Updating" transactions? The above is valid only for when "Inserting" transaction.

Thank you!

Rollin

Former Member
0 Kudos

I only gave you the table and field name because it may need different syntax based on your SP.

Former Member
0 Kudos

Use the following query within SP to check if the User is a Super User or Not



SELECT T0.[Internal_K], T0.[U_NAME] FROM OUSR T0 where T0.superuser='Y'

Former Member
0 Kudos

HI Gordon and Sri,

Thank you. But won't the statement

Select * from OUSER where superuser = 'Y'

returns me all users that are superuser only? I will only like to know if the "current" logon user of this workstation is a superuser or not.

Thanks again,

Rollin

Former Member
0 Kudos

Use this code



if exists (Select T0.cardcode from oinv T0 where T0.U_Name is null and T0.DocEntry = @list_of_cols_val_tab_del
and T0.usersign in (SELECT T0.[Internal_K] FROM OUSR T0 where T0.superuser='Y'))
	begin
		SET @error = 10
		SET @error_message = N'UDF is Null'
	end

The above code Checks if the Invoice is Created by the SuperUser, then blocks the Invoice.

Former Member
0 Kudos

It is as simple as OUSR.SUPERUSER = 'N'

Thanks,

Gordon