cancel
Showing results for 
Search instead for 
Did you mean: 

Order blocked by user / Workflow error handling

Former Member
0 Kudos

Hi Folks,

I am getting this requirement quite often. Time to address it in a more efficient way than that I know.

The following is the requirement:

Workitem goes to approver. If the approver approves/rejects the workitem, there is a subsequent change in the sales order which is handled by BAPI in the next step. If the sales order is locked by some user, BAPI does not make change and throws an error.

Solution that I can think of:

The way it is handled right now is - if there is an error message from BAPI - the workflow is routed to a power user or an email message is sent to admin asking him to inform the right user.

This approach of mine does not sound correct. Can we actually throw error at the time when the approver tries to open the workitem itself (i.e. see if the transaction is being locked and if it is locked - throw an error and do not allow the approver to take action ).

Thanks,

aby.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

I think you can make use of the condition Tab in the background step that calls the BAPI.

I think the Create Workitem Tab inside the Condition tab of the step can be used to check whether its locked or unlocked.

Thanks

Arghadip

keohanster
Active Contributor
0 Kudos

Hi Folks,

I am getting this requirement quite often. Time to address it in a more efficient way than that I know.

The following is the requirement:

Workitem goes to approver. If the approver approves/rejects the workitem, there is a subsequent change in the sales order which is handled by BAPI in the next step. If the sales order is locked by some user, BAPI does not make change and throws an error.

Solution that I can think of:

The way it is handled right now is - if there is an error message from BAPI - the workflow is routed to a power user or an email message is sent to admin asking him to inform the right user.

This approach of mine does not sound correct. Can we actually throw error at the time when the approver tries to open the workitem itself (i.e. see if the transaction is being locked and if it is locked - throw an error and do not allow the approver to take action ).

Thanks,

aby.

Hi Aby,

If I understand this correctly, the sales order can be blocked by some other application during the approver's task?

Is the approval task a decision task, or a custom task? If custom, perhaps you could include some locking/unlocking code?

I suppose you could implement a before-method to check for a lock - but you aren't able to pass data back to the approval task from a before method. You could check for a lock in a separate task prior to the approval task, but there is no guarantee that the user would complete the task before someone else locks the object up again.

Another approach might be to check the results of the BAPI, and if it's throwing an 'Object locked' type of error, call it again. Of course, you would need to put some wait time in the BAPI, and also, you would need to ensure it does not go on waiting and trying forever. But nobody likes to admit they put wait steps into anything.

Just a few ideas to consider. I wonder if this problem is that persistent?

Sue

Former Member
0 Kudos

Hi Sue,

Thanks for your answer. I tried checking the transaction enque in a method and use this method in Secondary methods of Dialog task.

To answer ur question - it is dialog step, not a custom task. In the dialog step - when the approver clicks on approve or reject - I would like to check if the transaction is locked and if it is locked - an error has to be thrown. I am checking if this can be done in program exit.

Please let me know if this can be done in different way.

thanks,

aby.