cancel
Showing results for 
Search instead for 
Did you mean: 

Block Manual JE for particular accounts

Former Member
0 Kudos

Hi all,

I need an SP where i can block any manual JE if the inventry accounts are selected. This is the query that i have but it returns errors;

IF @transaction_type = 'A' AND @object_type = '30'

BEGIN

if exists(Select '141010','141020' from [dbo].[JDT1] T0

Where T0.BaseEntry IS NULL

AND T0.DocEntry=@list_of_cols_val_tab_del)

begin

SELECT @error = 1, @error_message = 'Manual JE for these accounts not permitted !'

end

END

Please assist.

Thanks,

Joseph

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi!

Try this

IF @transaction_type = 'A' AND @object_type = '30' 
BEGIN
if exists(Select T0.Transid from dbo.JDT1 T0
Where T0.Account in ('141010','141020' ) 
AND T0.Transid=@list_of_cols_val_tab_del)
begin
SELECT @error = 1, @error_message = 'Manual JE for these accounts not permitted !'
end
END

Answers (2)

Answers (2)

former_member206488
Active Contributor
0 Kudos

Dear,

Try this:

IF @transaction_type = 'A','U' AND @object_type = '30'

BEGIN

if exists(Select T0.Transid from dbo.JDT1 T0

Where (T0.Account = '141010' or T0.Account=' 141020' )

AND T0.Transid=@list_of_cols_val_tab_del)

BEGIN

SELECT @error = 1, @error_message = 'Manual JE for not permitted '

END

END

Hope this will solve your problem.

regards,

Neetu

Former Member
0 Kudos

Hi,

Try this

IF @transaction_type = N'A' AND (@Object_type = N'30') 
BEGIN 
if Exists ( select t1.account from jdt1 t1 
where t1.account = '141010' and t1.transid = @list_of_cols_val_tab_del)
BEGIN 
SELECT @Error = 1, @error_message = N'Manual JE for these accounts not permitted !!'
END
END

Hope this help,

Son.