on 09-01-2014 4:38 PM
Buenos días alguien me puede colaborar con el siguiente SP no me esta funcionando pero no encuentro que sucede gracias
if @transaction_type in ('A','U') and @object_type = '17'
begin
declare @duplicado as Nvarchar(50)
set @duplicado = (select NumAtCard from ORDR where DocEntry =@list_of_cols_val_tab_del)
IF Exists (SELECT COUNT(NumAtCard) FROM ORDR WHERE NumAtCard = @duplicado HAVING COUNT (NumAtCard) > '1')
begin
set @error =1
set @error_message ='Existen documentos duplicados'
end
end
Hola juan,
Prueba de esta manera, debes verificar si tienes otra validación donde siempre ingresan la referencia, porque si esta vacia también te validara que se repite.
IF @object_type = '17' AND (@transaction_type = 'A' OR @transaction_type = 'U')
BEGIN
declare @duplicado nvarchar(50)
declare @contador int
SET @duplicado=(select NumAtCard from ORDR where DocEntry =@list_of_cols_val_tab_del)
SET @contador=(SELECT COUNT(*) AS Contador
FROM ORDR T0
WHERE T0.NumAtCard=@duplicado)
IF (@contador>1)
BEGIN
SELECT @error = 101
SELECT @error_message = N'Referencia Duplicada'
END
END
Saludos,
WV
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
SI claro copie el que me enviaste pero no entiendo que pasa estoy en Modulo Ventas-Clientes y opción Pedidos -Clientes y bueno y estoy trabajando en el ambiente de testing pero eso no debería afectar. acabe de realizar otra prueba ejecutando el SP y realice el ingreso de otro pedido coloque el mismo numero en Referencia y permitió crear.
Gracias
Como esta Wuilmer tampoco me esta funcionando pero ahora no se si es que el Sp que realice tampoco me esta funcionando o quedo mal estructurado.
if @object_type in ('17') AND (@transaction_type = 'A' OR @transaction_type = 'U') begin
if(select Count(*) FROM ORDR A
WHERE (ISNULL(A.NumAtcard,' ') = ' ')
and A.DocEntry=@list_of_cols_val_tab_del)>0
begin
set @error = 10
set @error_message = '!!!! SP OBLIGATORIO -- Por favor incluir referencia.!!!!'
END
END
Gracias por tu ayuda
prueba con este
IF @object_type = '17' AND (@transaction_type = 'A' OR @transaction_type = 'U')
BEGIN
IF @transaction_type = 'A' or @transaction_type = 'U'
BEGIN
declare @num int
SET @Num=( SELECT COUNT(*) AS Contador
FROM ORDR T0
WHERE (T0.NumAtCard IS NULL OR T0.NumAtCard ='' ) and T0.DocEntry =@list_of_cols_val_tab_del)
IF (@Num>0)
BEGIN
SELECT @error = 101
SELECT @error_message = N'Debe Ingresar Campo refrencia'
END
END
END
Versión SQL
Microsoft SQL Server Management Studio 10.50.2500.0
Microsoft Analysis Services Client Tools 10.50.2500.0
Microsoft Data Access Components (MDAC) 6.1.7601.17514
Microsoft MSXML 3.0 4.0 5.0 6.0
Microsoft Internet Explorer 8.0.7601.17514
Microsoft .NET Framework 2.0.50727.5466
Operating System 6.1.7601
Versión SAP
SAP Business One 9.0 (9.00.060) PL: 08 (32-bit)
Gracias por tu tiempo en verdad que pena pero es importante para mi solucionar esto
Cierra esa conexión, ya voy saliendo, mañana a primera hora me conecto envíame la nueva conexión mañana a primera hora, mi correo es venegas90@hotmail.com
User | Count |
---|---|
86 | |
7 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.