Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to write store procedures for batch detail table - OBTN

kengaun
Member
0 Kudos
265
  • SAP Managed Tags:

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

0 REPLIES 0