2023 Apr 10 4:32 AM
I would like to create store procedure for OBTN table. To block user from changing the status Released to other status for a particular item code.
The sp block not able to trigger when I changed the status to Locked..
Is my code correct ? Object type correct ? Any advise from any expect ?
DECLARE @XPIShelf as varchar(10) , @XPBShelf as varchar(10) , @XPItemx as varchar(50), @XPBatch as varchar(50)
IF @object_type in ('10000044') AND @transaction_type IN ('U')
BEGIN
select
@XPItemx= a.ItemCode,
@XPBatch = a.DistNumber
from obtn a
where a.AbsEntry=@list_of_cols_val_tab_del
and a.ItemCode='MT-NTF-828-BKAA'
and a.Status = '0'
IF @XPItemx <> ''
BEGIN
select @error = -1
select @error_message = 'You''re not allowed to change Status where Batch - ' + @XPBatch + ' for Item Code - ' + @XPItemx + ''
END
END