cancel
Showing results for 
Search instead for 
Did you mean: 

Resstrict production qty more than sale order

Former Member
0 Kudos

Dear Experts,

If for item A having 50 qty in sale order no 1. Then production order is added for that sale order selecting that sale order and project code. if sale order no and project code matches then production planning qty should not more than sale order qty.

Thanks & Regards,

Hiren

View Entire Topic
kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

Please try this:

IF @transaction_type IN ('A','U') AND

(@Object_type = 202)

BEGIN

If EXISTS (SELECT T0.Docentry FROM OWOR T0 LEFT join RDR1 T1 on  T0.[Project]  =  T1.[Project] INNER JOIN ORDR T2 ON T1.[DocEntry] = T2.[DocEntry]

WHERE T1.[Quantity] <> T0.[PlannedQty] and  T2.[DocNum]  =  T0.[OriginNum]   and  T0.[ItemCode]  =  T1.[ItemCode] and  T0.[Status]  = 'P' and T0.[Docentry] = @list_of_cols_val_tab_del)

Begin

SET @error = -1

SET @error_message = N'Planned quantity is more than sales order quantity'

End

END

Thanks