cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Cancelling workflow & trigerring workflow email from program

Former Member
0 Likes
1,091

Hi Experts,

I have never worked on workflows earlier.

There is a workflow in our system in which user receives email in SAP inbox to approve/reject a PR item.

Once the user takes action, the workflow has custom code to approve/reject the PR item, then send emails in workflow tasks & cancel the workflow.

However, sometimes users also approve/reject PR item through ME54N transaction.

This does not update in the workflow due to which workflow keeps on sending reminder emails and(or) escalation emails.

Client do not want to use the option of substitution.

Following is the approach that I have determined to resolve this issue (after having an offline discussion with the developer who is not with our project anymore):

1. Find user-exit which gets triggered when user approves/rejects from ME54N

2. In that user-exit I need to code following:

   a. Obtain the workflow pertaining to this PR item

   b. Cancel the workflow

   c. Send the approval/rejection emails as given in workflow

I need help on the Function Modules to be used for points 2.a & 2.b.

Also for point 2.c, I was wondering whether is it possible to call the same workflow task (using some Function Module) which sends emails along with the required data.

If it is not possible then I would need to code logic for email separately in the user-exit. Due to this the email subject & body content & format would have to be managed at 2 places: Workflow & User-exit which I want to avoid.

Thanks in Advance.

Apologies if requirement of points 2a & 2b is very common & available elsewhere.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Likes

Hi,

Please don't use exits or other abap heavy ways in fixing this issue.

I guess that the workflow was not designed properly. Usually you design a workflow in such a way that either approval through user decision (and some bg task) or through normal means using transactions will in both cases continue the flow.

In sap standard for PO and PR the task used for approval has several terminating events. These events could come from the release transaction or even from a bapi/function module. That way the workflow doesn't mind where approval comes from and will subsequently go to the next step in the workflow.

Kind regards, Rob Dielemans

Former Member
0 Likes

Hi,

I think you can define the terminating event for corresponding user decision task. so once it is directly approved via ME51N, it will be removed from user's inbox. Email can be send as a seperate step or via program exit as per the decision taken.

You can take the reference of SAP Standard purchase order Workflow for terminating event.

Regards,

Priyanka

anjan_paul
Active Contributor
0 Likes

Hi,

  I thnik involve an Workflow consultant directly to your project will help you as lot of steps are there where critical decision need to taken

I042439
Product and Topic Expert
Product and Topic Expert
0 Likes


Hi Sanket

An easier and clean way would be to :

1) First check which event gets triggered in the system when Approved/Rejected from ME54N (switch on the trace using SWELS and then post via ME54N -> check event in SWEL) ... remember to switch off the trace when done (using SWELS)

2) Once you have the event, in the workflow , have the decision is a 1 of two fork -> one branch for decision and other which waits for that event.

3) Let the event end the decision and go to the mail step of the workflow to send the Approval/Rejection email.

I would suggest that you rope in a workflow consultant to do this. With no experience in workflows, it will be a bit difficult for you to do this.

The approach of Exit and cancelling outside the workflow seems to be over engineering.

Regards,

Modak