cancel
Showing results for 
Search instead for 
Did you mean: 

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

0 Kudos

Hi,

I'm really new to SAP and have only been working in it for two months, but have picked up a few tips and tricks already and done som b1 validation configs to suit our company, but now I am stuck at this one query a colleague had.

He wishes for a pop up message to appear for a certain item, if it is out of stock at the time and added to a sales order.

I think I'm somewhere half there in my mind. I believe I need to set the function to trigger when validated (leaving a field) and to form 139, item 38 and column 1 and when the number in OITW.OnHand is equal to 0 and the field RDR1.ItemCode is equal to the item in mentioned, the message is triggered. But I have no idea how to write this in the SQL condition box or if I'm even close to the right thing!

It also needs to be triggered if the amount in the field for OITW.IsCommited is higher than in the field for OnHand or when the number in RDR1.Quantity is higher than in OnHands.

Hope this makes sense to anyone!

Regards

Maria

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member227598
Active Contributor
0 Kudos

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

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

Welcome to SAP B1 forum.

By using SP_TN (Transaction Notification), you can get such message for your quantity for both committed and on-hand quantity.

Form number and field information are useful when you creating Formatted Search Queries (FMS).

To create TN, you need to know objtype for sales order and transaction type (Add, Update). Please use tables ORDR, RDR1, OITM to create SP_TN.

Thanks