cancel
Showing results for 
Search instead for 
Did you mean: 

SP for the OINV for Negative amount

Former Member
0 Kudos

Hi Experts,

I have tried a SP for blocking the OINV when the Vatsum or Doctotal is negative due to AR Downpayment adjustment.

IF @transaction_type IN ('A', 'U') AND @object_type = '13'  

BEGIN  

If exists (SELECT T0.DocEntry FROM OINV T0 

  where (t0.VatSum < 0 or t0.DocTotal < 0)     

    and t0.docentry =@list_of_cols_val_tab_del) 

Begin 

SET @error = 123 

SET @error_message = 'Tax or Doctotal is Negative' 

End 

END 

Regards,

Dwarak

Accepted Solutions (1)

Accepted Solutions (1)

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

What is your problem in above SP?

Working without any error.

Thanks & Regards,

Nagarajan

Answers (3)

Answers (3)

KennedyT21
Active Contributor
0 Kudos

Hi Dwarakanath P

Please check and the close the Thread with correct and helpful answers

Regards

Kennedy

KennedyT21
Active Contributor
0 Kudos

Hi..

In you condtion it will allow the user with the 0 doctotal check with my post it will block with 0 invoice also

Regards

Kennedy

Former Member
0 Kudos

Hi...

I said that if it is negative figure. then it mean it is only less than 0.

Thanks with regards,

Dwarak.

Former Member
0 Kudos

Hi Dwarak,

I suggest you to run a simple query first to see if you can get anything:

SELECT T0.DocEntry FROM OINV T0  where t0.VatSum < 0 or t0.DocTotal < 0

Thanks,

Gordon

KennedyT21
Active Contributor
0 Kudos

Try this

IF @transaction_type IN ('A', 'U') AND @object_type = '13' 

BEGIN 

If exists (SELECT T0.DocEntry FROM OINV T0

  where     

     t0.docentry =@list_of_cols_val_tab_del AND  (t0.VatSum <= '0' or t0.DocTotal < ='0'))

Begin

SET @error = 123

SET @error_message = 'Tax or Doctotal is Negative'

End

END 

Regards

Kennedy