Try this
IF @object_type = '112'
AND @transaction_type in ( 'A' ,'U')
BEGIN
IF EXISTS (
SELECT t1.DocEntry
FROM ODRF t1
INNER JOIN drf1 t2
ON t1.DocEntry=t2.docentry
WHERE @list_of_cols_val_tab_del = t1.DocEntry
AND (
ISNULL(t2.OcrCode, '') = ''
OR ISNULL(t2.OcrCode2, '') = ''
)
)
BEGIN
SET @error = -9
SET @error_message = 'Select the Cost Center and Departments.'
END
Regards
Kennedy