cancel
Showing results for 
Search instead for 
Did you mean: 

Back Order Stored Proc

Former Member
0 Kudos

Hi Guys

i have created this backorder stored proc that blocks all orders that will take the item into negative, ie selling more than actually available, it works 99% well, issue is i dont know where and why the stored proc still allows certain unknown scenarios to go through. i think i might have to amend it slightly and add " where t0.onhand - t1.quantity < 0", this could block all orders that will make the onhand negative. and yes this is only sold from one warehouse. Thanks

if( @object_type = '17' and(@transaction_type = 'A' or @transaction_type = 'U'))

begin

set @backorder = (select top(1) T0.itemcode from rdr1 T0 inner join oitw T1 on T0.WhsCode = T1.WhsCode where

(T0.Quantity >= T1.OnHand) and T0.itemcode = T1.itemcode and T0.docentry = @list_of_cols_val_tab_del )

if(@backorder is not null)

begin

set @error = 1

set @error_message = N'Item '@backorder' exceeds available quantity'

end

end

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Sorted, had to add in "iscommited" into calculation