I have developed a custom w/f using a custom business object. It is triggered from a custom transaction.
A person creates the transaction and then saves it. Workflow gets triggered and then goes to the Approver.
When the Approver executes the work item, then it opens the transaction in display mode and when approver chooses to go back, it takes him to the user decision where he can choose approve or reject option.
If he rejects , then he enters the comments for rejection and sends back for modifying the transaction. This block works fine.
If approver has decided to approve the transaction, then I need to check in the workflow if someone is already editing that record directly by executing the transaction. This particular user decision step uses METHODS tab in the W/F task and uses the BEFORE WORK ITEM EXECUTION block.
My question is how can I give an error message when the approver clicks on the Approve button , saying "Document is already being editied " ?
I check for if the transaction is locked or not. If locked then I use the below option.
exit_return 9001 sy-msgno sy-msgv1 sy-msgv2 sy-msgv3.
It doesn't work..
Please suggest how can I give error message when the workitem is executed ?
Thanks in advance...