on 02-23-2011 3:36 PM
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.
IGUAL, SIGUE SIN FUNCIONAR.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
EXCELENTE !
ESTOY IMPRESIONADO DE LA RAPIDEZ CON QUE ME PUDIERON AYUDAR MEDIANTE EL FORO, QUE BUEN APOYO HAY AQUI.
MUCHAS GRACIAS MAURICIO.
SALUDOS..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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??
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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??
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
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.