This may help you,
IF @transaction_type IN ('U') AND @Object_type = '202'
BEGIN
IF EXISTS (SELECT T0.DocNum
FROM OWOR AS T0
where T0.DocEntry = @list_of_cols_val_tab_del AND ObjType='202')
BEGIN
SELECT @Error = 6, @error_message = 'Production order Update restricted'
END
END
Regards,
Shan.