I have created a stored procedure which updates a UDF on the PO when a certain criteria is met. The stored proc works fine, however, for some reason i am unable to add any items with this proc activated - any idea why? Proc below:
--Set QC parametre on PO
IF @transaction_type = 'A' or @transaction_type = 'U' AND @object_type = '22'
declare @QC as nvarchar(20)
set @QC = (
select distinct 'Yes' from por1
inner join opor on OPor.DocEntry = POR1.DocEntry
inner join OITM on OITM.ItemCode = POR1.ItemCode
OITM.U_QC = 'Yes'
set opor.u_QC = @QC where opor.docentry=@list_of_cols_val_tab_del