Hello Experts,
In our project, due to some reasons duplicate workflows are getting created. Based on our research and debugging we feel that these workflows are in different - different LUW's due to which we are not able to even debug the complete flow. Below is our business scenario:
Activity A is at status "Wait for 27 days" and after completing 27 days, via RSPPFPROCESS process program it moves to the next status (From E--0039 to E0040) on which we are creating a follow up activity (On Save) and changing the activity status to E0061- Completed.
While parent activity is going on, after few checks, follow-up activity also moves to the next status so in this scenario following operations were performed:
1. Changed Parent activity status from E0039 to E0040 (Via RSPPFPROCESS program)
2. At Status E0040 (Which is scheduled on Save) - creates a follow up activity and changes parent activity status to completed - E0061.
3. On Save itself follow up activity moves to the next status (E0001 to E0004).
In this whole process, any status change is done via workflow so we have created 3 workflow in this process:
Workflow 1: Change parent activity status from E0039-E0040.
WorkFlow2: Change Parent Activity Status from E0040 to E0061.
Workflow 3: Change follow-up activity status from E0001 to E0004.
If we run this process for individual activities then everything goes fine but if we run it for 5 or more then 5 activities, it creates multiple WorkFlow 3 for 1-2 activities while the action log suggests that action as triggered only once. Till now we are unable to find the root cause .
From Technical Point of view, below are the details:
For status change, workflow is triggered from activity actions via tRFC in background tasks, which triggers an event to trigger the workflow. Inside the workflow, we have enhanced BUS200126 object and called standard method CHANGEMULTIPLE which is followed by CRM_ORDER_SAVE and commit work in our workflow custom method.
Inside Activity actions, we are creating follow-up activities using CRMD_ORDER_MAINTAIN FM which is followed by register for save as mentioned below:
CALL METHOD lcl_action_execute->register_for_save
EXPORTING
iv_source_header_guid = l_act_guid
iv_additional_header_guid = g_child_guid
ip_application_log = l_log
iv_recursive_det = space.
What we have done so Far:
1. Before triggering workflow, we tried to print the call stack to check from where the workflow is getting created - It takes us to standard action execute method while we do not see that action is triggered multiple times.
2. To stop the duplicate workflow, we tried to check in buffer if any STARTED or READY status workflow exist, if exist then do not create one more workflow but it did not work so what we feel that workflows are getting created at the same time in different -different LUW's.
3. With the logic mentioned in step 2, we tried to use the workflow CHECK function module (Via config) but that also failed and did not stop the multiple workflows.
4. We removed CRM_ORDER_SAVE and Commit work from workflow but then statuses stopped moving.
5. In activity action configuration, we tried to make the action one time, but action is already triggered only 1 time which creates multiple workflows so this was also not useful.
Is there anything else which we can do to tackle the problem? we have already checked our custom code for multiple workflow triggers but could not find anything wrong with the code and on top of that it does not seems to be code issue as it happens with 1-2 activities when 5 or more activities are run by RSPPFPROCESS program,.
Any help or pointer would be really appreciated.
Thanks, Sandeep