cancel
Showing results for 
Search instead for 
Did you mean: 

Approval Procedure

Former Member
0 Kudos

Hi,

In Business Partner Form I created an UDF for Approval Status and set a valid values as Approved and Not Approved. Default value is Not Approved.

If user creates a new vendor it will be Not Approved in Default. Only the Authorized super user can Approved the vendor. For this i created a procedure. The code follows:

IF (@transaction_type = 'A' or @transaction_type = 'U') AND @Object_type = '2'

Begin

DECLARE @usersign int, @appsts nvarchar(20)

SELECT @usersign=usersign,@appsts=U_appsts from dbo.OCRD where cardcode=@list_of_cols_val_tab_del

IF (@usersign not in (select userid from ousr where userid='1') and @appsts='A')

SELECT @ERROR = 1, @ERROR_MESSAGE = 'Only Authorized user can change the Status'

ELSE

SELECT @ERROR = 0, @ERROR_MESSAGE = 'SUCCESSFULLY UPDATED'

End

Here the problem is if User A has the rights & if a record created in user A then he is able to Approve it but User A is unable to Approve the record created by User B even though it has rights. Plz give me the solution.

Thanks in Advance,

Regards,

Madhavi

Accepted Solutions (1)

Accepted Solutions (1)

former_member186095
Active Contributor
0 Kudos

Hi,

does the user A has userid = '1' ?

What is actually you want to attain here ?

I have tested your query and I think it would better to use general authorization --> business partner --> select no authorization to user other than userid 1. If the BP master data can be save as draft, it is okay but it is not.

Tell me what is the reason you use approval store procedure if it is actually the userid 1 that can add the new BP.

Rgds,

Former Member
0 Kudos

Hi Michael,

Here the problem is user id 1 was unable to Approve the BP created by User id 2 because in the select command usersign has id 2. So the problem occurs.

My requirement is user id 1 should only have the approval rights and can approve the BP created by all other users.

Madhavi

former_member186095
Active Contributor
0 Kudos

Hi,

I have a work around beside using your solution.

I suggest to create a UDF named approver, so it will be U_Approver. Assigned this FMS :


SELECT t1.userid from 
 OUSR T1 WHERE T1.INTERNAL_K = $[user]

Using the above FMS, it will make the UDF to be filled with userid number. Then make the field is unable to edit in all the users except in the user manager (user id 1). This can be done using UDF settings (CtrlshiftB) --> untick the active column of the field. So, it won't be able to change by all the users.

Use this following SP_TN :



IF (@transaction_type = 'A' or 
@transaction_type = 'U') AND @Object_type = '2'
Begin
DECLARE @usersign int, @appsts nvarchar(20), 
@approver nvarchar(20)

SELECT @usersign = usersign, @appsts = U_appsts, 
@approver = U_approver from dbo.OCRD 
where cardcode=@list_of_cols_val_tab_del
if (@appsts = 'A' and @approver <> '1')
SELECT @ERROR = 1, @ERROR_MESSAGE = 
'Only Authorized user can change the Status'
End

So, when user id = 1 open and want to approve, it will be available to do by override the approver value.

userid 1 can do that by shift+F2 or just type 1. After userid 1 changed the approver to be 1,, then userid 1 changes the U_Appsts to be approve. After changed, click update button.

It will be succesfully updated.

Rgds,

Answers (0)