cancel
Showing results for 
Search instead for 
Did you mean: 

Workitem getting logically Deleted

nilesh_bhayani2
Explorer
0 Kudos

Hello,

I am using FI document park functionality for Finance document.

In overall functinality, there is 1 main workflow and 1 sub-workflow. Sub-workflow is being used to Reject/ Approve Parked document and it is being called in mid of main workflow.

In main workflow, there is an event based wait step which requires REJECTED event to be trigerred. Now when I am using FM SAP_WAPI_WORKITEM_COMPLETE (with _WI_RESULT = 002 and _RESULT = 2 in SIMPLE_CONTAINER, here REJECTED code is 002) to reject parked document programatically it is completing sub-workflow correctly without any issue but when it is returing to main workflow it is marking Event based wait step (for event REJECTED) as Logically Deleted.

If I reject parked document manually then there is no issue and it is marking Event based wait step (for event REJECTED) as COMPLETED. Can you please help on what should be done to REJECT workitem correctly(in COMPLETED status)?

Accepted Solutions (0)

Answers (1)

Answers (1)

pokrakam
Active Contributor
0 Kudos

This is correct behavior. The wait is for an external event such as you doing the rejection directly on the document. By using the API you are rejecting it via workflow.

One method cancels (= logically deletes) the other. You will find that rejecting via the document will set the approval step to cancelled.

nilesh_bhayani2
Explorer
0 Kudos

Thanks for your reply, so there is no way to complete workflow programatically same as when we Reject it manually from front end?

And as it is logically deleting Rejection Wait step and not completing it, is there any issue in future?

pokrakam
Active Contributor
0 Kudos

Yes there is, to simulate the same way would be to raise the event programatically. It really depends on the business process what you are trying to achieve.

The workflow does two things: Asks a user to approve/reject, and waits for this to be done outside of WF. If either one of these actions happens, the other is cancelled. Logically deleted is a perfectly normal state for 'unused' workflow steps.

In my opinion, using the API to reject the user's work item is functionally incorrect, because the user isn't doing the rejecting. Better would be to raise the rejected event. But then both alternatives have different follow-on activities, so we're back to: you need to understand the business process and required behavior. Nobody here can answer that part for you.

nilesh_bhayani2
Explorer
0 Kudos

I have already tried raising 'REJECTED' event programatically and it is rejecting workflow document but as I mentioned that REJECTED wait step is in Main workflow so raising REJECTED event is only completing main workflow and not completing subworkflow. In manual Rejection, it is completing subworkflow as well as REJECTED wait event step.

Anyway thanks for your reply. I was looking for some way to complete workflow process programatically same as it completes during manual approve/ reject workflow process.

pokrakam
Active Contributor
0 Kudos

What you describe is not possible in normal operations.

A main workflow cannot complete without completing the subworkflows. Please review what is really happening.