on 11-30-2015 2:11 PM
Estimados un buen día,
Por favor su gentil ayuda tengo una duda. En SAP Business One si tengo un documento de marketing por ejemplo una Factura de Cliente con 100 líneas y me da un error al querer crear el documento como es posible saber sobre que línea se está generando el error? Esto de alguna manera es estándar?
Mi pregunta es porque registré un Transaction Notification que me indica si estoy vendiendo por debajo del costo, y funciona, ya que me genera el error y no me permite crear, pero como puedo saber en que línea está sucediendo?
Les agradezco mucho si alguien puede ayudarme.
Un saludo cordial
Sandra Piña
PD: Este es el transaction notification:
IF (
SELECT COUNT(*)
FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
LEFT JOIN OITW T2 ON T1.ItemCode=T2.ItemCode
WHERE T2.AvgPrice>T1.Price AND T0.docentry=@list_of_cols_val_tab_del
)>0
begin
set @error = 10
select @error_message = 'SP: Precio articulo menor al costo'
end
End
Declara una variable que te guarde el item que encuentre con precio menor al costo
Luego esa variable que deberá ser de tipo varchar, la concatenas en el mensaje de error por ejemplo
select @error_message= 'Item '+@item+' con precio menor al costo'
Algo así
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hola, Sandra.
Modifiqué un poco tu query, quedando de la siguiente forma:
IF (
SELECT COUNT(*)
FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
LEFT JOIN OITW T2 ON T1.ItemCode=T2.ItemCode
WHERE T2.AvgPrice>T1.Price AND T0.docentry= @list_of_cols_val_tab_del
)>0
begin
DECLARE @Cad VARCHAR(MAX)
SET @Cad = ''
SELECT @Cad = replace(REPLACE((SELECT Item AS [data()] FROM
(SELECT distinct convert(nvarchar(3),T1.VisOrder+1) + '@' + T1.ItemCode Item
FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
LEFT JOIN OITW T2 ON T1.ItemCode=T2.ItemCode
WHERE T2.AvgPrice>T1.Price and t0.DocEntry = @list_of_cols_val_tab_del) T order by 1 FOR XML PATH ('')), ' ', ', '), '@', ' - ')
set @error = 10
select @error_message = 'SP: Precio articulo menor al costo' + @Cad
end
Esto te permitirá ver en un solo mensaje todos los artículos que no cumplen con tu condición (fila y código de artículo). Esto ayuda cuando más de una fila tiene precio debajo del costo.
Saludos y nos cuentas cómo te fue,
JC.
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 | |
9 | |
9 | |
5 | |
4 | |
4 | |
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.