cancel
Showing results for 
Search instead for 
Did you mean: 

TRANSACTION NOTIFICATION, COMO BLOQUEAR CAMPO CARDNAME EN DATOS MAESTROS-SN

Former Member
0 Kudos

COMO PUEDO PONER UN BLOQUEO EN EL TRANSACTION NOTIFICATION PARA QUE NO SE PERMITA MODIFICAR EL CAMPO DE RAZON SOCIAL (CARDNAME) NI CONDICIONES DE PAGO (GROUPNUM) DE DATOS MAESTROS DE SOCIOS DE NEGOCIOS (OCRD)??

GRACIAS DE ANTEMANO A TODOS.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

IGUAL, SIGUE SIN FUNCIONAR.

former_member188440
Active Contributor
0 Kudos

Ok ya lo probe asi

mas simple


IF @object_type in ( 2) and @transaction_type in ('U') 
BEGIN
 


if 
(select cardname from ocrd where cardcode=@list_of_cols_val_tab_del ) --coloca aqui signos de menor que y mayor que 
(select top 1 cardname from acrd where cardcode=@list_of_cols_val_tab_del and loginstanc in (select max (loginstanc-1 ) from acrd where  cardcode=@list_of_cols_val_tab_del))

 
begin
set @error = 1
set @error_message = 'Acceso denegado para cambio de Razon Social'
end
 
END


felipe_loyolarodriguez
Active Contributor
0 Kudos

Mauricio,

Probe tu SP y funciono sin problemas agregando el operador no es igual (!=)

Saludos

Former Member
0 Kudos

esto es para bloquear a todos los usuarios pero en el caso que quisiera darle permiso solo a los personas que crean socios de negocios como se haria?

Former Member
0 Kudos

hOLA

TALVES ESTE TE AYUDE

IF @transaction_type IN ('U') and @object_type in ('2') begin

       IF (SELECT COUNT(*)

            FROM  OCRD T0  INNER JOIN OUSR T1 ON T0.UserSign = T1.USERID

            WHERE (T0.GroupNum IS NOT NULL )

            AND T0.CardCode = @list_of_cols_val_tab_del AND t1.USERID != (27) AND t1.USERID != (59) ) >0 BEGIN

                  Set @error=10

                  Set @error_message= '**SP - NO PUEDE CAMBIAR CONDICIONES DE PAGO '

            END

Answers (7)

Answers (7)

ega007
Member
0 Kudos

Cambia e campo de Grupcode por campo CardName

IF @object_type IN ('2')AND @transaction_type IN ('U') -- VALIDACIONES PARA SOCIO DE NEGOCIO

BEGIN

declare @newcanal varchar(100)

declare @oldcanal varchar (100)

declare @user varchar (100)

--en la sig. consulta el nombre del Grupo de ventas lo que estamos llenando lo guardamos en @newname

set @newcanal=(select GroupCode from ocrd where cardcode=@list_of_cols_val_tab_del )

set @oldcanal=(select top 1 GroupCode from acrd where cardcode=@list_of_cols_val_tab_del and loginstanc in (select max (loginstanc ) from acrd where cardcode=@list_of_cols_val_tab_del))

set @user=(SELECT T2.U_HAK_LICDCF FROM OCRD T2 WHERE T2.CardCode = @list_of_cols_val_tab_del)

--select @newcanal,@oldcanal

if @newcanal <> @oldcanal and @user <> 1

BEGIN

SET @error = 1

SET @error_message = 'No esta autorizado para definir el SN en otro Grupo'

END

END

Former Member
0 Kudos

EXCELENTE !

ESTOY IMPRESIONADO DE LA RAPIDEZ CON QUE ME PUDIERON AYUDAR MEDIANTE EL FORO, QUE BUEN APOYO HAY AQUI.

MUCHAS GRACIAS MAURICIO.

SALUDOS..

Former Member
0 Kudos

NO FUNCIONO , AL PARECER ES PORQUE NO SE ESTAN GUARDANDO LOS VALORES EN LOS PARAMETROS @NEWNAME Y @OLDNAME.

PORQUE SI SUSTITUYO LOS QUERYS QUE LES DAN EL VALOR POR NUMEROS CUALQUIERA, SI CORRE EL ULTIMO IF Y TE ARROJA EL MENSAJE.

QUE CREES QUE SEA??

former_member188440
Active Contributor
0 Kudos

Cambia la variable por



@list_of_cols_val_tab_del

Former Member
0 Kudos

SI PUES SE SUPONE QUE CON EL SIG. QUERY SE TOMA EL VALOR QUE ESTOY TECLEANDO EN LA PANTALLA DE DATOS MAESTROS DE SN, DEL CAMPO DE RAZON SOCIAL.

Select @newname=cardname from ocrd where cardcode=@list_of_key_cols_tab_del

DESPUES ESTE OTRO ES PARA COMPARAR @newname CON EL PENULTIMO REGISTRO DEL CAMPO DE RAZON SOCIAL DE LA TABLA DE HISTORIAL ACRD

if @newname <> (select CardName from acrd where CardName=@list_of_key_cols_tab_del and LogInstanc=(select max(loginstanc)-1 from acrd where CardCode=@list_of_key_cols_tab_del and cardcode=@list_of_key_cols_tab_del))

LO QUE NO SE ES SI ESTOY USANDO CORRECTAMENTE EL PARAMETRO @list_of_key_cols_tab_del EN AMBOS QUERYS

Y SORRY POR HACER TANTAS PREGUNTAS..

former_member188440
Active Contributor
0 Kudos

A ver intenta con


-- BLOQUEO DE RAZON SOCIAL EN DATOS MAESTROS SN

IF @object_type = 2 and @transaction_type in ('U') 
BEGIN

-- Declaramos una variable que guarde el valor de la razon social de SN
declare @newname varchar(100)
declare @oldname varchar (100)
--en la sig. consulta el nombre de razon social que estamos llenando lo guardamos en @newname
set @newname=(select cardname from ocrd where cardcode=@list_of_key_cols_tab_del )
set @oldname=(select top 1 cardname from acrd where cardcode=@list_of_key_cols_tab_del and loginstanc in (select max (loginstanc -1) from acrd where  cardcode=@list_of_key_cols_tab_del))



if @newname != @oldname

begin
set @error = 1
set @error_message = 'Acceso denegado para cambio de Razon Social'
end

END


END

Former Member
0 Kudos

FIJATE QUE YA MODIFIQUE EL MAX A MAX(CAMPO)-1 , HICE LA PRUEBA PARA VER SI ME TRAIA LA INFO CORRECTA EN GENERADOR DE CONSULTAS, PERO ACA EN EL TRANSACTION NOTIFICATION NO HIZO NADA CUANDO MODIFIQUE EL CAMPO DE RAZON SOCIAL EN SAP, OSEA NO FUNCIONO EL BLOQUEO.

QUE ESTARE HACIENDO O CODIFICANDO MAL??

former_member188440
Active Contributor
0 Kudos

Es que te falta la comparacion de los valores que traes contra los que estan en la ACRD, tienes que validar que SEAN iguales, si no, entonces el error

Former Member
0 Kudos

MUCHAS GRACIAS, ME SIRVIO TU RESPUESTA PARA VER COMO IBA A SACAR EL ULTIMO CAMBIO DE X SOCIO DE NEGOCIOS.

LO QUE PUDE CONSTRUIR FUE ESTO:

-


-- BLOQUEO DE RAZON SOCIAL EN DATOS MAESTROS SN

-- Aqui le decimos que actue solo cuando el tipo de objeto sea 2 (Ventana de Socios de Negocios, y cuando este en modo Crear y Actualizar)

IF @object_type = 2 and @transaction_type in ('U')

BEGIN

-- Declaramos una variable que guarde el valor de la razon social de SN

declare @newname varchar(100)

--en la sig. consulta el nombre de razon social que estamos llenando lo guardamos en @newname

Select @newname=cardname from ocrd where cardcode=@list_of_key_cols_tab_del

--En la consulta anterior no estoy seguro si este correcto utilizar @list_of_key_cols_tab_del para que se tome el valor

--del cardcode del campo que estamos llenando de razon social.

if @newname <> (select CardName from acrd where CardName=@list_of_key_cols_tab_del and LogInstanc=(select max(loginstanc)

from acrd where CardCode=@list_of_key_cols_tab_del and cardcode=@list_of_key_cols_tab_del))

--en consulta anterior se compara si el valor nuevo a guardar o actualizar es diferente al que ya existe en la tabla de historial de SN

begin

set @error = 1

set @error_message = 'Acceso denegado para cambio de Razon Social'

end

END

--END

-


MUCHAS GRACIAS POR SU AYUDA..

former_member188440
Active Contributor
0 Kudos

Creo que para la ACRD, el loginstance debes tomar el MAX -1 pues el MAX es el que estas por "grabar" a nivel base de datos, entonces el ultimo grabado (MAX -1) si es el que te servira

former_member188440
Active Contributor
0 Kudos

Para esto necesitarias basarte en la tabla de historial , para comparar los datos que estas modificando

ACRD, ordenandolo por loginstanc

tendrias que hacer una comparacion entre la OCRD (transaction_type in ('U')) y la ACRD buscando los utlimos valores existentes para el socio de negocios que estas modificando