I want to make a check so that if a user reaches a workitem to his inbox, checks if the user has
permissions to run it and if he do not have the permissions to be forwarded to all users.
I am using the class IF_SWF_IFS_WORKITEM_EXIT.
With this class I managed to forward the workitem when you press cancel (sy-ucomm = 'CANC').
But in this case it does not work properly.
I tried to put the code when the event is executed (im_event_name) is' BEF_EXEC 'and' STATE_CHG 'but when launching the error
workitem remains in the Ready status, and although it seems that all users have received the workitem, they can not execute it.
I have also tried with the event 'AFT_EXEC' but if you try to change the state the workflow becomes wrong.
You know how I can do to stop the execution of the workitem and send to everyone?
Thanks in advance.