cancel
Showing results for 
Search instead for 
Did you mean: 

SP to Restrict Other Users to POST Journal Voucher

former_member609283
Participant
0 Kudos

Hello EveryOne,

     I have came across a situation that only user "Manager" can Post Journal Voucher other user can't, whereas other users can Add Journal Voucher but cannot POST it.

Thanks in advance

Accepted Solutions (0)

Answers (2)

Answers (2)

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

Please don not post multiple thread on same subject.

Check this thread

Thanks & Regards,

Nagarajan

Former Member
0 Kudos

i had restricted sales order..by using below code..

U just modify some data.

and also refer the table ousr and journal voucher tables for getting the usersign...

IF (@object_type = '17') and (@transaction_type IN ('A', 'U')) 

BEGIN 

          IF EXISTS (SELECT T0.Docentry from ORDR T0 Inner Join RDR1 T1 ON T0.Docentry=T1.Docentry where 

          T1.DocEntry = @list_of_cols_val_tab_del and ((T0.[UserSign]  =1))) 

          BEGIN 

                    Select @error = 10, @error_message = 'Your are not allowed to add the docuemnt' 

          END 

END 

---

through the coding also u can restrict user wise if u need..

former_member609283
Participant
0 Kudos

Hey Srinivas,

     Please have a look on it...It gives me strange error that "Error while converting Nvarchar to int", whereas i have checked its data types.

IF (@object_type = '28') and (@transaction_type IN ('A', 'U'))

BEGIN

          IF EXISTS (SELECT T0.BatchNum from OBTD T0

          where T0.BatchNum = @list_of_cols_val_tab_del and T0.[UserSign]=1)

          BEGIN

                    Select @error_message = 'Your are not allowed to add the document' 

          END

END

Regards,

Idrees

Former Member
0 Kudos

hi,

Still checking.

i am also getting the same problem.

@list_of_cols_val_tab_del

the above one is giving the error.

checking...

former_member609283
Participant
0 Kudos

please let me know when its done...

By the way, why it is giving an error??

former_member609283
Participant
0 Kudos

Any Updates on it??

Former Member
0 Kudos

Hi,

Try adding  Convert(datatype,field)

ex:

IF (@object_type = '28') and (@transaction_type IN ('A', 'U'))

BEGIN

          IF EXISTS (SELECT T0.BatchNum from OBTD T0

          where T0.BatchNum = convert(int,@list_of_cols_val_tab_del) and T0.[UserSign]=1)

          BEGIN

                    Select @error_message = 'Your are not allowed to add the document'

          END

END

or try the one below.

IF (@object_type = '28') and (@transaction_type IN ('A', 'U'))

BEGIN

          IF EXISTS (SELECT T0.BatchNum from OBTD T0

          where convert(int,T0.BatchNum) = @list_of_cols_val_tab_del and T0.[UserSign]=1)

          BEGIN

                    Select @error_message = 'Your are not allowed to add the document'

          END

END

please take note if the BatchNum field datatype is nvarchar you should use the nvarchar(character size) ex: nvarchar(20) as datatype instead. same with the @list_of_cols_val_tab_del both field/parameter should be the same datatypes.

jim