Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3347

Re: Message for "out of stock" items when added to a sales order

$
0
0

Hello Maria,

 

Please try the Below SP in SBO_SP_TransactionNotification in SQL.

 

IF @object_type='17' AND @transaction_type='A'

BEGIN

declare @ItemCode as NVarchar(100)

Set @ItemCode = (SELECT ItemCode from RDR1 where DocEntry =@list_of_cols_val_tab_del)

declare @Qty as Numeric (20)

Set @Qty = (Select Quantity FROM RDR1 where DocEntry =@list_of_cols_val_tab_del)

IF EXISTS (SELECT * FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry

                    INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode INNER JOIN OITW T3 ON T2.ItemCode = T3.ItemCode WHERE

                    T0.DocEntry = @list_of_cols_val_tab_del AND T1.WhsCode=T3.WhsCode and (T3.[OnHand] - T3.[IsCommited])<@Qty)

BEGIN

SELECT @Error = -1, @error_message = 'Item Quantity' + ' ' + @ItemCode + ' ' +'is greater than available'

END

END

 

if any query then reply .

 

Rgds,

Kamlesh Naware


Viewing all articles
Browse latest Browse all 3347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>