Skip to Content
0
Nov 13, 2019 at 04:48 PM

Block duplicate Asset Code in Purchase Request

184 Views Last edit Nov 13, 2019 at 04:49 PM 2 rev

Hi Expert,

I tried this code in SP to block Asset Code that have already been purchased.
But instead the effect is all asset code are blocked.

Please Help.

Thank You.

---Block duplicate Asset Code
if @transaction_type in ('A','U') AND @Object_type = '1470000113'
begin
if exists (select T0.ItemCode, Count(T0.ItemCode) 
FROM PRQ1 T0 where T0.DocEntry=@list_of_cols_val_tab_del 
GROUP BY T0.ItemCode
having count(T0.ItemCode) >1
)

set @error=1
set @error_message = 'Cant duplicate item'

END
-------