cancel
Showing results for 
Search instead for 
Did you mean: 

Block users who are not marked as Super Users through SP

Former Member
0 Kudos

Hi experts,

I am trying to block certian users (those not being Super Users) from making changes to posted Sales Orders.

So far I have a simple code that blocks all users

if @object type = '17' and @transactiontype = 'U'

Begin

Set Error = 1

Select @error_message = 'Cannot modify a posted Sales Order'

End

How would I code it so that it would only block users who are not marked as Super Users?

Thx

Richard

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Richard,

Try this process for implementing your scenario:

1)Create a Stored Procedure to check whether User is a Super User or Not

2) Exec this procedure in SBO_SP_TransactionNotification stored procedure (when obj type=17 and trans type=add)

Regards,

Praneeth

Edited by: Praneeth Putlur on Apr 27, 2010 10:19 PM

Former Member
0 Kudos

What I have so far is this.....

-- cannot alter a posted Sales Order

if @object_type='17' -- Sales Orders

AND @transaction_type='U' -- for Add or Update

BEGIN

declare @SuperUser nvarchar(100)

select @SuperUser = SUPERUSER FROM OUSR WHERE Internal_K = user

If @SuperUser = 'N'

BEGIN

set @error = 1

select @error_message = 'Cannot alter a posted Sales Order / Commande Client !'

END

END

When I code this in the SP, SQL interprets the user as the user for SQL and returns dbo, how to I get the currently logged in user in SAP?

Former Member
0 Kudos

Is there any reason you don't want to use the standard authorisations for this purpose?

former_member204969
Active Contributor
0 Kudos

The SP can not access the user directly, only by the actual transaction. But for update transactions the user is stored only in the archive table. So you can use this a little more complicated procedure:

IF @object_type='17' and @transaction_type='U'-- Sales Orders update
BEGIN
Declare @user int
Select top 1 @user=o.UserSign from ADOC o
 where o.ObjType=17 and o.DocEntry=@list_of_cols_val_tab_del
 order by o.LogInstanc desc
If (Select SUPERUSER FROM OUSR WHERE Internal_K = @user) = 'N'
select @error = 1,
  @error_message = 'You cannot alter a Sales Order !'
END

Answers (0)