Hi Romel,
It will block document, even if its approved.
But we can add one more condition in "Where" clause to skip approved document.
Field Name to identify authorization statu is WddStatus.
Please try below query
If @object_type = '13' And @transaction_type in ('A')
If Exists(Select T0.DocEntry
From OINV T0
INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
Where T0.DocEntry = @list_of_cols_val_tab_del
and T0.WddStatus <>'P' -- to skip approved document from validation
And T1.Price< T2.[LastPurPrc] )
Begin
SET @error=@list_of_cols_val_tab_del--@object_type;
SET @error_message = 'Sales Price is less than Last Purchased Price'
End
Thanks
Unnikrishnan