on 04-27-2010 7:28 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
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
User | Count |
---|---|
104 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.