cancel
Showing results for 
Search instead for 
Did you mean: 

Purchase Requisition Approval Workflow

Former Member
0 Kudos

Hi ABAPers,

I would like to be able to create a workflow that is such that it sends an e-mail to the approver saying something like 'PR 10000010 created by SAPUser was created. Please release (approve)'.

I have scheduled the program RSWUWFML2 with the apropriate variant and it is working fine. So far, the workflow sends an e-mail to the creater of the PR only, together with the work item attached, but does not send to the approver.

But the solution I need is to be able to

1. Send the e-mail I have mentioned to the first approver in the release strategy in transaction ME52N.

2. If this first approver does not approve within 2 working days, it then sends that e-mail to the second approver, and so on...

3. The workflow ends when the approvals are done by all in the release strategy.

Is there a standard way that I can use to do this or I would have to create tasks, events etc?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

1. Send the e-mail I have mentioned to the first approver in the release strategy in transaction ME52N.

You can use SWNCONFIG (ECC 6.0) or RSWUWFML2 to send e-mails to outlook when ever a workitem arrives in the Business workplace Inbox. You need to specify the tasks in Filter Settings of the configuration for which e-mail notification has to be sent.

(There are lots of posts on SWNCONFIG in SDN and you can figure out how to do the config).

_2. If this first approver does not approve within 2 working days, it then sends that e-mail to the second approver, and so on... _

Standard Functionality doesn't support this.. You need to customize your workflow by using Modelled Deadline Monitoring to achieve this requirement.

3. The workflow ends when the approvals are done by all in the release strategy.

This is achieved in the standard workflow itself.

Regards,

PR.

Former Member
0 Kudos

Thanks a lot for your contribution, PR

I have a few more questions if you don't mind,

What are the implications of all this on the Organizational Unit design? How will the modeled deadline monitoring mechanism determine the next approver in the release strategy and restart the workflow with the message (i.e. PR created by ... needs to be approved) to the next approver if the first does not approve within the 2 day period?

Regards,

Darlington

Former Member
0 Kudos

There is no need to restart the workflow if the first does not approve within the 2 day period.

Automatically the workitem escalates to the next approver (you can easily write the logic to determine the next approver if you can find the tables where the approvers are stored). In the task you create during the Modelled deadline, you can specify in the Description that "so and so PR has been created by ... and the 1st approver hasn't taken action in 2 days.....)

Check out this link on the same requirement.

This link also mentions you to search on a term "Processing Obsolete" which should be used to achieve your requirement..

Regards,

PR.

Former Member
0 Kudos

Hi Darlington,

In order for SAP to determine the correct manager who needs to release the PR (and also the manager who needs to recieve the email), you need to define them in customizing.

1) In SPRO, go to MM > Purchasing > PR > Release Procedure > With Classification > Set Up Procedure, and then click on the Release Codes step. Here, you will put a '1' in the column titled workflow.

2) In SPRO, go to MM > Purchasing > PR > Release Procedure > With Classification > Set Up Procedure, and then click on the Workflow step. Here, you will input the user who will need to recieve the notification. In our situation, I used the username of the manager. So, I had the Group Z1, code L1, plant, Object type US, and Agent ID JCHANSKI. Any PR which triggered the strategy in group Z1 at level L1 sent a work item to my Business Workplace inbox.

3) In the workflow, use standard task TS00007986, and rule 00000148. These should determine the user from table T16FW (the table which contains what you entered in step 2). I'd suggest testing that task in PTFC and making sure it can determine the agent correctly, before going to the workflow.

4) Set up SAP to send an external email whenever a work item is recieved in the user's inbox. It looks like you have this step already done.

Hope this helps,

J

Former Member
0 Kudos

Thank you J and PR. I believe I am almost there. But I am left with a hitch.

The workflow is not sending a notification to the approvers. I have &WF_ACT_AGENT& in the field for agent in the Task while I am selecting Expression in the drop-down. If I select User and put in my username, it sends the 'Please release...' notification to my SAP Business Workplace Inbox and to my internal (outlook) mail. The Task is using default rule 20000026. Is there anything wrong here?

Regards,

Darlington

Former Member
0 Kudos

I'm not sure if you made a custom workflow or used the standard workflow for PR release, but the easiest way is to use the standard task and rule for finding the agent.

The task you need to determine the agent is TS00007986. This should default to rule 00000148 - Person responsible for requsition. In order to test if this rule is finding the agents you have defined in customizing, go to tcode PFAC, and enter task 00000148. Test using the simulate button. In the new window, search and select a PR which you have in the system that correctly found a release procedure, and also enter the release code. Then execute the test, and it should find and display the Agent ID if your customizing is done correctly.

In my case, the PR is released at line item level, and I had my container element ReleaseCode referencing structure T16FW, field FRGCO to find the code. The requisition container was referencing BUS2009.

Make sure that this simulation works correctly, and after that put in task TS00007986 to your workflow.

Former Member
0 Kudos

It's absolutely fine that the task is using the Rule 20000026.

The difference is as follows for your understanding.

As far as i understand, If its Rule 20000026 or Rule 00000148, it should not matter becoz both the Rules uses the same Function Module for Agent Determination.

What matters is the Configuration of the Release codes and the Release strategies along with the agent assignment in the Workflow part..

Overall Release.

WS20000077 uses the Task TS20000159 and the agent determination is done via Rule 20000026. BO is BUS2105

Item-Level Release

WS00000038 is the workflow which uses the Task TS00007986 and the agent determination is done via Rule 00000148.

BO is BUS2009.

The Main Question is how are you determining the Agents.

Is it Dynamic or Hard coded.

1) Agent Assignment can be done via configuration in SPRO where you give the Agents Userid's in the workflow part of the "Setting up Release Procedure with Classification".

2) It can be done Via User Exit. You can find the User Exit in the Rule itself.

In the Release codes, you need to either select 1 or 9 for the workflow field depending on how you want to determine the Agent.

Hope this should give you some more inputs...

Regards,

PR.

Former Member
0 Kudos

Thanks for your contributions, PR and J.

Ok, guys here is my situation. I am using a custom workflow (WS99900008) with an 'Overall Release of requisition' step containing standard task 99900009 with rules 20000026 for Agent and 99900001 for Recipient for Missed Requested End with the requested end having a custom rule 99900001 with function Z_PR_DEADLINE. I have set the time to +2 days.

1. I need it to send a message to the first person in the Release strategy saying 'Please release...',with a work item attached for releasing. This it is NOT doing.

2. The deadline monitoring is working fine, It sends a message to the first person in the release strategy saying 'The first deadline for the release of purchase requisition 10000070 created by DARLINGTON was missed' if 2 days pass. This it is doing.

3. When those 2 days pass, it is supposed to send to the SECOND person in the strategy saying 'Please release...'(same as in point 1, above), with a work item attached, for releasing. This it is not doing as well.

4. When a person in the release strategy releases the PR, a message is sent to the person who CREATED the PR saying 'Purchase Requisition Released by ...' . This it is doing.

The step 'Overall Release of requisition' is almost the same as the standard workflow containing task 99900009 except for:

On the control tab, Agents block, I have put expression &WF_ACT_AGENT& (is this correct?). I have added a task description says 'Please release...'

On the Requested End tab, I have added deadlline time as 2 days and in the Display Text I have added rule 99900001.

Generally function Z_PR_DEADLINE gets the next person in the strategy and I,m using ME_REL_GET_RESPONSIBLE for agent determination (coz i use task 20000026).

Is there anything wrong with all this?

Thanks again.

Former Member
0 Kudos

Hi Darlington,

I'm not 100% sure about what your flow looks like, and I've only done a few workflows myself, but...

One thing that I think might be a problem is that Agent part of the control tab. For whichever step that is supposed to send a workflow item to the approver, I believe you should have it set to be a 'Rule' and '20000026' instead of that expression. This rule is the one that has ME_REL_GET_RESPONSIBLE (which is correct), and so this rule will determine the agent and send the workitem appropriately.

It looks like your problems of 1. and 3. are the same - that the agent determination isn't working. Check your rule in PFAC to see if the rule is correctly determining the agent. If it is, make sure that the binding is correctly setup in the workflow to pass the release code and requisition to this rule.

I'm not sure about the deadline stuff, but the agent determination should be able to be debugged in PFAC by testing values and looking at the FM.

Former Member
0 Kudos

Thanks, J

I have followed your advice and it worked! Rule 20000026 is what I needed to send a notification saying 'Please release...' to the FIRST person in the release strategy. So, that means point 1. is solved. Now, I am left with point 3., where I need to send to the SECOND person the same message after a 2 day deadline, then to the THIRD person after another 2 day deadline (total four days) etc....Does Rule 20000026 really work as the rule in the Requested End tab (I did try it and it didnt) , or I need a custom one. Or is there a standard one specifically for that purpose of escalation of the message?

Your assistance is greatly appreciated.

Thanks again.

Former Member
0 Kudos

How that rule 20000026 works, is that whenever the task is triggered, the release code and PR are passed on to it, and it determines the agent from there. So, as long as the first approver made the approval, then the second release code should be passed the next time, and the second approver should be notified. And so on.

I've never tried using the Requested End tab. Since it's a tab in the same step in the workflow, I don't know if it "refreshes" the container information when the deadline is hit. I'm thinking it might use that same initial information that was used to send the workflow item to manager 1... is it sending any work items out after the deadline?

I'd probably suggest posting a new thread about the requested end in the workflow forum, I'm sure there are people with more experience ready to help!

Former Member
0 Kudos

Thanks, J

I did have the same thoughts about the container refreshing in the same step as well. I also don't think it refreshes by getting the second approver. The only work item it is sending after the deadline contains a message saying 'Missed Deadline: Please release PR ....' to the inbox (Deadline Messages) of the first person in the release strategy. But it doesnt send to the SECOND approver the message 'Please release...', which is what I'm left with in this solution.

Let me post a new thread for that topic. I really do appreciate your contributions, both J and PR. You have been a great help.

Former Member
0 Kudos

Hello J,

In order for SAP to determine the correct manager who needs to release the PR (and also the manager who needs to recieve the email), we need to define them in customizing.

I have setup the first two steps in IMG.

Can you please put some light regarding point 3.

3) In the workflow, use standard task TS00007986, and rule 00000148. These should determine the user from table T16FW (the table which contains what you entered in step 2). I'd suggest testing that task in PTFC and making sure it can determine the agent correctly, before going to the workflow.

I am using SWETYPV and SWDD and it automatically bring the task against WS20000077. But do I need to activate it?

In PFTC, when I am assigning the User, do I need to add user against each rel/code.

or it will automatically pick from the MM-config(MM > Purchasing > PR > Release Procedure > With Classification > Set Up Procedure, --Workflow step)

Can you please put some light on it.

Other thing I found that in PFTC, container tab, it is only get 'Release codes' without classification (which we are not using).

I don't know why it is not picking 'Release codes with classification'. However it is picking correct release codes in Pur/req header.

Many thanks.

JAT

Edited by: JAT on Aug 22, 2011 12:06 AM

Edited by: JAT on Aug 22, 2011 4:38 PM

Answers (0)