Skip to Content
avatar image
Former Member

Block Manual JE for particular accounts

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Feb 23, 2010 at 10:03 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 23, 2010 at 10:02 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 23, 2010 at 10:12 AM

    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

    Add comment
    10|10000 characters needed characters exceeded