on 02-12-2010 8:01 PM
estimados cree la siguiente rutina con la intencion de validar las lineas de una oc para obligar al usuario a ingresar el centro de beneficios por linea:
/* Valida cebes en OC */
IF (@object_type= '22') and (@transaction_type='U' or @transaction_type='A')
begin declare @cebe char(5) set @cebe = (select T0.OcrCode from por1 T0
where T0.Docentry = @list_of_cols_val_tab_del) if len(ltrim(isnull(@cebe, ''))) = 0
begin
SET @error = 1
SET @error_message = 'El campo Centro de Beneficio es Obligatorio'
end
end
pero me entrega el siguinte errror si pongo mas de una linea en la orden de compra
http://www.subirimagenes.com/otros-error-4053369.html
quedo atento a sus comentarios
saludos cordiales
VALM
Hola
Prueba el siguiente código...
-- VALIDACION DE OBLIGATORIEDAD CAMPO PROYECTO A NIVEL DE DOCUMENTO
IF @object_type IN ('22') AND @error = 0 --OBJECT TYPE DE OITM
AND @transaction_type IN ('A','U')
AND @list_of_cols_val_tab_del <> ''
BEGIN
DECLARE @Con_CB Int
SET @Con_CB = 0
IF @object_type = '22' --ORDEN DE COMPRA
BEGIN
SET @Con_CB = (SELECT COUNT(*)
FROM OPOR T1 INNER JOIN POR1 T0 ON T0.DocEntry = T1.DocEntry
WHERE T1.DocEntry = @list_of_cols_val_tab_del
AND ISNULL(T0.OcrCode,'') = ''
AND T1.Doctype = 'I')
END
if @Con_CB > 0 begin
set @error = 130
set @error_message='Debe ingresar campo CB'
end
END
Espero te sea de ayuda,
Saludos Cordiales,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
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.