Stored Procedure for PO !!!
I am trying to generate one SP to restrict purchase order having null value in row level field.
I have 1 scenario that in Purchase order we have created 1 UDF say U_SO(Sales Order No.). This UDF is auto filled through FMS for particular Item having open Sales Order. Now client requirement is to restrict purchase order if U_SO field is empty or null.
I have created 1 SP for this but its not working. can anybody suggest where I am wrong.
If @object_Type = '22' and @transaction_Type = 'A'
If Exists (Select OPOR.DocEntry from OPOR inner join POR1 on OPOR.DocEntry = POR1.DocEntry
where (POR1.U_SO Is Null or POR1.U_SO = '0') and OPOR.DocEntry = @List_of_cols_val_tab_del)
Select @error = -101,
@error_message = N'Please enter Sales Order No.'