cancel
Showing results for 
Search instead for 
Did you mean: 

AR Reserve Invoice Stored Procedure Control

krishnam_mathur
Explorer
0 Kudos

Hi Community,

I need to place a control on AR reserve Invoice. They should be based on a Sales Order.

Regular AR Invoice should not get affected. I wrote below code but there is an error

if @object_type = '13' and @transaction_type in ('A','U') begin if not exists ( select t0.DocNum from oinv t0 inner join inv1 t1 on t0.DocEntry=t1.DocEntry where t0.DocType='I' and t0.isIns='Y' and t0.CANCELED <>'C' and t1.BaseType='17' and t0.DocEntry=@list_of_cols_val_tab_del --and t0.UserSign<>'4' ) begin set @error=1 set @error_message = 'AR Reserve Invoice should be based on SO' end end

Accepted Solutions (0)

Answers (1)

Answers (1)

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

Try this query,

if @object_type = '13' and @transaction_type in ('A','U')

begin if exists

( select t0.DocNum from oinv t0 inner join inv1 t1 on t0.DocEntry=t1.DocEntry where t0.DocType='I' and t0.isIns='Y' and t0.CANCELED <>'C' and t1.BaseType <>'17' and t0.DocEntry=@list_of_cols_val_tab_del )

begin

set @error=1

set @error_message = 'AR Reserve Invoice should be based on SO'

end

end

Regards,

Nagarajan