Saturday 4 June 2016

Stored Procedure - Blocking Negative Discounts for SQ, SO, PO



-------------------------------Negative Discount in SQ-----------------------------------------------------------------------
 
If @object_type = '23' and @transaction_type in ( 'A','U')



BEGIN
 
If exists

(Select P.DocEntry, P.DocCur From OQUT P INNER JOIN QUT1 Q on P.DocEntry = Q.DocEntry

Where Q.DocEntry=@list_of_cols_val_tab_del

and P.DocCur = 'INR' and Q.DiscPrcnt < 0 )

Select @error = 2310000-01,

@error_message = 'Discount(%) should not be Negative. Pl Check Discount/Total Sales Price in SQ'



end
 
-------------------------------Negative Discount in SO-----------------------------------------------
 
If @object_type = '17' and @transaction_type in ( 'A','U')



BEGIN
 
If exists

(Select P.DocEntry, P.DocCur From ORDR P INNER JOIN RDR1 Q on P.DocEntry = Q.DocEntry

Where Q.DocEntry=@list_of_cols_val_tab_del

and P.DocCur = 'INR' and Q.DiscPrcnt < 0 )

Select @error = 1710000-01,

@error_message = 'Discount(%) should not be Negative. Pl Check Discount/Total Sales Price in SO'



end
 
-------------------------------Negative Discount in PO-------------------------------------------------
 
If @object_type = '22' and @transaction_type in ( 'A','U')



BEGIN
 
If exists

(Select P.DocEntry, P.DocCur From OPOR P INNER JOIN POR1 Q on P.DocEntry = Q.DocEntry

Where Q.DocEntry=@list_of_cols_val_tab_del

and P.DocCur = 'INR' and Q.DiscPrcnt < 0 )

Select @error = 2210000-01,

@error_message = 'Discount(%) should not be Negative. Pl Check Discount/Total(LC) in PO'



end

No comments:

Post a Comment