cancel
Showing results for 
Search instead for 
Did you mean: 

Validation in Decision Task

Former Member
0 Kudos

Hi All,

I have a decision task in my workflow which is working fine .

Now my requirement is I want to check the user name and except one particular user , for all other I have to show message you are not Authorized to approve .

Is there any exit or some other way to do this ?

Thanks

Manik

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Dear Manik,

As far as I have understood, you are getting user name as input to your workflow. Except one particular user you for others you want to show that they are not authorized to approve.

Create an method in your BO and pass the username as input to it. Write your logic to evaluate the user name and populate a mutilne container element (say actual_agents). Export this value from method. Make the task as background task.

Please tell me how you want to inform agents that they are not authoriozed to approve. Once thing you can do is add a method to your BO to display a popup to inform agents that they are not authorized to approve. Assign actual_agents in expression of this acitivity.

Kindly correct me if I have understood you wrongly.

KR,

S Bharath

Former Member
0 Kudos

Hi Bharath,

Thanks for your reply .

Actully this problem cannot be solved by any method as far as I think .

The task would be sent to all the possible agents . Note that Agents are not the actual approver . There would be only one approver whose Id is known. Now at the time of opening the task i.e while opening the task from Business workplace , I want to check the user name (through any method , validation routine , user exit or any possible thing ) and if it is not the required approvers user ID , I want to show a message that you are not authorised .

The message can be the same as we use in programs or any other pop will also do , but this should keep the task in the users inbox , should not delete it from inbox.

Hope now the problem is clear .

Thanks

Manik

Edited by: Manik Dhakate on Oct 6, 2009 12:33 PM

former_member554978
Active Contributor
0 Kudos

The task would be sent to all the possible agents .

Which means your task will be marked as general and there wont be any agent assignmnet at the task level.

if you do it like this, then the workitem will be sent to all and there wont be any limitation to access the same.

so its always betterto do the agent assignment at task level.

Former Member
0 Kudos

Dear Swami,

Thanks for your reply. As per his requirement he has said that once one user clicks the workitem it should not disappear from the inbox of others. But as per general nature of workitems I fear this is not possible. Also you have asked to restrict the task by agent assignment.

Does this mean like creating two activity steps with actual agent as expression in 1 activity step and rest of other users as expression in another activity.

KR,

S Bharath

former_member554978
Active Contributor
0 Kudos

I have just asked him to do the normal agent assignmnet. Thats it.

by doing, he can send the workitem to the desired agent.

Once the user executes the WI, then it will be dsiapperaed and this a standard behavior.

Former Member
0 Kudos

Dear Manik,

Create a method in your BO. Add a logic as below.

If sy-uname = 'Actual approver'.

your logic.

elseif sy-uname = 'Other user'.

write popup code

endif.

Include this method in Tab Methods of activity step under "Methods BEFORE Workitem Execution(Modal Call)". This will work. Try it and let me know if you face any issues.

KR,

S Bharath

paul_bakker2
Active Contributor
0 Kudos

Hello,

Why even send a decision workitem to users who aren't authorized to execute it?

And even if you did, you then want the workitem to stay in their inbox forever?

I think you'd find users would soon ignore everything in their inbox.

regards

Paultje Bakker

Hanabi Technology

Former Member
0 Kudos

Well friends lets make it some more clear :

Suppose the task is there in agents inbox . Now sometimes what happens is the agent forwards the workitem to some other person . Now I have to check depending upon some conditions whether this person is authorized to approve it .

Now if someone can suggest some way where I can can write some code which gets executed at the time of opening the decision task for authorization check depending upon conditions . And if these conditions fails , I want to display the message and this decision task would be kept as it is in his inbox.

The reson for keeping the task in inbox is there is deadline monitoring active which will delete the task automatically after 2 days and will forward it to correct person .

Thanks

Manik

bpawanchand
Active Contributor
0 Kudos
suggest some way where I can can write some code which gets 
executed at the time of opening the decision task for 
authorization check depending upon conditions .

The simple solution is make use of Program exits tab of the decision task,

[For more information please check this|https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/programExitsIn+Workflow

]

Former Member
0 Kudos

Thanks Pavan ,

Hope this would work for me.

Answers (1)

Answers (1)

former_member554978
Active Contributor
0 Kudos

You can create a Zmethod and write the logic for validation and after that please create a send mail task and you can write the error message in subject line and in mail body as well.

user id have to be detremined in the above method and it shud bestored in a variable and make sure that parameter is export parameter of that method.