revised version
IF(@object_type ='68')and(@transaction_type in('A','U'))
BEGIN
IFExists(SELECT T0.DocEntry
FROM OWOR T0
INNERJOIN ORDR T1 ON T0.OriginNum = T1.DocNum
INNERJOIN RDR1 T2 ON T1.DocEntry = T2.DocEntry
WHERE T0.PlannedQty > T2.Quantity AND T0.OriginNum = T1.DocNum AND T0.ItemCode = T2.ItemCode
AND T0.DocEntry = @list_of_cols_val_tab_del)
Begin
SET @error = 14999
SET @error_message ='Planned quantity more than SO quantity'
End
End