on 06-30-2016 8:05 PM
Estimados,
Como puedo hacer para que el campo dbo.OCRD.U_Linea sólo lo pueda modificar o ingresar dato un usuario SAP conectado con manager Usersign = '1'.
Tengo el siguiente bloqueo para que el campo U_Linea no esté NULO:
IF @object_type = '2' --oInvoice
BEGIN
IF @transaction_type = 'A' or @transaction_type = 'U'
BEGIN
SET @Num=( SELECT count(*) FROM dbo.OCRD WHERE (dbo.OCRD.U_LineaGMT is null) AND (dbo.OCRD.UserSign = '1')
AND dbo.OCRD.CardCode=@list_of_cols_val_tab_del)
IF (@Num>0)
BEGIN
SELECT @error = 2030
SELECT @error_message = N'Campo línea GMT, no puede estar vacío. Favor incorporar línea "0"'
END
END
END
he le incorporé UserSign = '1'. Pero no me funciona. Alguien me puede ayudar?.
Saludos.-
Intenta con
IF @object_type = '2' and @transaction_type in ( 'A', 'U')
BEGIN
declare @usercrea as int
declare @useractualiza as int
select @usercrea=usersign, @useractualiza=usersign2 from ocrd where
cardcode=@list_of_cols_val_tab_del
if
( select isnull(U_LineaGMT,0)=0 from ocrd where cardcode=@list_of_cols_val_tab_del )=0
and (@usercrea !=1 or @useractualiza !=1)
begin
SELECT @error = 2030
SELECT @error_message = N'Campo línea GMT, no puede estar vacío. Favor incorporar línea "0"'
end
END
*** Necesitas comparar el usersign2 que es e usuario que Actualiza, el que crea es usersign***
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Tienes que obtener el usuario conectado de esta forma:
Declare @User as varchar(50)
SET @User= (Select top 1 UserCode from USR5 where SessionID=@@spid order by Date desc,Time desc)
IF @User <> 'manager'
BEGIN
---aquí va tu bloqueo para cuando son usuarios normales.
END
NOTA: Cuando sea manager no hara ningun bloqueo y te dejara modificar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
109 | |
15 | |
10 | |
5 | |
4 | |
3 | |
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.