I am trying to assign 1 validation for scenario mentioned in the subject. The validation which i have tried is showing me error even if i have not changed the unit price at the GRPO level.
IF @transaction_type IN (N'A', N'U') AND
(@Object_type = N'20')
if exists (SELECT T1.[Price], T3.[Price] FROM OPDN T0 INNER JOIN PDN1 T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN OPOR T2 ON T2.DocEntry=T1.BaseEntry INNER JOIN POR1 T3 ON T2.DocEntry = T3.DocEntry
WHERE T1.ItemCode=T3.ItemCode And T1.[Price]<>T3.[Price])
select @Error = 10, @error_message =
'UNit price is different from PO'