1. INTRODUCTION TO WORKFLOW SCENARIO
This scenario is based on Purchase Order Change. This scenario will prove helpful to all those people who are absolutely new to WORKFLOWS in SAP.
There are 4 conditions to be followed in this scenario.
Condition 1: The workflow should trigger on PO change.
Condition 2: The PO type should be NB <standard type>.
Condition 3: If the PO changer and the PO creator are different then, send a mail to PO creator with the subject line as follows:<PO number> is changed by <PO changer>
Condition 4: If the PO creator does not check the mail in 10 minutes, send a Reminder Mail. As per the very first condition, the workflow should trigger on PO change that is whenever a PO is changed; this Workflow should trigger automatically.As per the second condition, the PO that is changed should always be NB type. On any other kind of PO change, this Workflow should not trigger.As per the third condition, who so ever changes the PO, if it is not the one who has created it, a mail should go to the PO creator to inform him that his this PO number is changed.As per the fourth condition, if the PO creator does not checks the original mail, a reminder mail should go to him after 10 minutes, informing him about the status of the earlier mail.
There are some transactions that need to be used and are as follows:-
2. TRANSACTIONS TO BE USED SWDD - Workflow Definition
(here the workflow creation will take place)
SBWP - SAP Inbox
(here we can check both the mail and the reminder mail)
ME22N - Purchase Order Change
(this is used to change the purchase order)
PFTC - Task Maintenance
(here we create a task)
SWO1 - Object Builder
(transaction used to create, display and modify business objects)
For a beginner, the following concepts used in this scenario will prove helpful.Start ConditionDeadline MonitoringStep Types <Condition, Activity, Mail>
3. THE STEP-BY-STEP PROCEDURE:-
The Workflow is actually built in SWDD transaction called The Workflow Builder. When we open SWDD the recently used workflow opens up, existing workflow.
- Click the create button and you will see a new workflow.
3.1 - Create 2 container elements in the Workflow container, since the values need to be transferred into those container elements. Double click on the Workflow Container Window and create. The data transfer takes place from event -> workflow -> task -> method.
3.1.1 - Create the first container element as creator14 of the type Workflow Initiator with table name as WFSYST and field name as INITIATOR.
Go to the Properties Tab and in the parameter settings check the Import checkbox for both the container elements.
3.1.2 - Create another container element of BOR type and name it as BUS2012 and using Business Object<BO> 2012. BO BUS2012 is used for Purchase Order.
Ø 3.2 - Click on the HAT, in the left top of screen, known as the Start Condition.
3.2.1 - The tab with basic data opens up. Enter the Workflow name and Workflow Description and change the release status to Released.
- Click on the Start Events tab - here we will give our start conditions.
3.2.2 - Give the category as BO...object type as BUS2012 and event as Changed.<Because WF should trigger on PO change>.
Now press active and click √, the Active button goes GREEN.
3.2.3 - Now click the Binding button. Drag and Drop the elements from the container and equate them. Click "√" and the binding button goes GREEN.
3.2.4 - Now click the Condition Tab. Here we have to specify the condition of PO type should be NB...NB type PO's are standard PO. Click the _EVT_OBJECT
- Click on the PurchasingDocType container Element and equate it to NB. We will get a condition in the last Rectangular Window.
Ø Click "√" and this completes the Start of the Condition..!!
Now SAVE and go back. The workflow now should look like this.
3.3 - Now double click on the un-defined step, create a Condition step since we have to put a condition of checking where creator and changer are not-equal/equal. Creator14 will contain the value of one who has created that PO and _Wf_Initiator will contain the value of the one who has changed that PO.
Click on "Click here to create new condition" and give the following condition.
Click "√" and the following screen appears.
Ø Click "√" and the following screen appear.
NOW IF BOTH <creator and changer> ARE SAME, WE DON'T HAVE TO DO ANYTHING.BUT IF BOTH ARE DIFFERENT WE HAVE TO SEND A MAIL WITH DEADLINE MONITORING OF 10 MINS.
Ø 3.4 - Go to that "both are different line" and then create an ACTIVITY.
Ø The screen asks for a task, we have to create a new task now.
Ø 3.4.1 - Go to transaction PFTC, select STANDARD TASK from task-type.
Ø Click on create and the following screen appears.
Ø 220.127.116.11 - Fill in the following details and save the task.Here ABBR is the name of the task.NAME is the description of the task.RELEASE STATUS should always be released so that we can use the task after releasing only.WORK ITEM TEXT will act as the subject line of task, as we have to send a mail with this description as the subject line. The OBJECT CATEGORY/METHOD/TYPE are the ones that we have already used.
Ø 18.104.22.168 - Click the Binding Button and press Transfer, and with that Automatic binding will take place. After that the binding will show Green.
After that the task will be created. Now simply we have to use this task name in that activity and then press Enter. You will see some buttons going GREEN. Now assign the agents. Select the option user and give the server name of the creator. Since the recipient of the mail is the creator. The screen appears like this.
Ø 3.4.2 - Now clicks the LATEST END tab for DEADLINE MONITORING of 10 minutes and insert the following values.
Ø Click "√" and Go back to the main screen.
Ø 3.5 - Now on the Reminder mail branch create a SEND MAIL <reminder mail> step type.
Ø Now Insert the following values in the Mail Step Type. In ABBR and NAME give any Z name of your choice.
Ø Now Click "√" and the screen appears like this.
Now the scenario portion is complete as of now. The thing is that we have to complete the workflow after sending a reminder mail.
Ø 3.6 - For that we use a Step Type called as PROCESS CONTROL. After the send mail activity create the process control step type to end the workflow.
Ø Now insert the following values in the process control.
Ø 4.0 - THE COMPLETE WORKFLOW SCENARIO IS LIKE THIS..
Ø Now once the WORKFLOW is complete, SAVE & ACTIVATE the workflow. Remove all errors and warnings. It should activate with 0 errors and 0 warnings..!!
5.0 - NOW COMES THE CONCEPT OF HOW TO CHECK THE FOLLOWING
1> How to trigger the Workflow?
2> How to change the Purchase Order?
3> How to check for the EVENT TRACE?
4> Where to check whether Workflow has started or not?
5> Where to check for the actual Mail and the Reminder Mail?
Ø 5.1 - Now go to transaction SWE4 - EVENT TRACE SWITCH ON/OFF. Click on SWITCH ON.
Ø 5.2 - Now go to transaction ME22N - The Transaction for PO Change. Choose a standard PO <NB Type>. Change any value, like Quantity, description and simply Save the PO.
Ø 5.3 - Now go to Transaction SWEL - DISPLAY EVENT TRACE.Click EXECUTE.
Ø Now we can see here the BO used is shown and the Workflows that are associated with it are also there. The status of workflow is also shown with being active/error. The Date and Time of the Workflows is also shown.
Now we know that our workflow has triggered, that means our purchase order has changed and the PO is of NB type. Now the issue is that we have to check whether the person who has created or changed the PO are same or different. If they are different, we should get a mail. For this what we have done earlier is that, on the server which we are working, we have created the 2 users. One user is to create the PO and other user to change the PO. So that they both can be different and we can get a mail. Another thing that we can do is that go to the condition step type and change the condition from equal to not-equal, and use the same server without any user.This will be simply for checking if other users on server are not available, as this is not the correct method.
Ø 5.4.1- Now we move to Transaction SBWP - SAP INBOX. Click OUTBOX and Click STARTED WORKFLOWS. There we can see our Workflow being started.
Ø 5.4.2 - Now go to INBOX -> WORKFLOWS, here you can see your mail being sent as an activity to the PO Creator.
Ø Do not double click on this activity and do not Confirm Work Item. As doing this would mean PO creator has checked the mail and there is no need of reminder mail.
In case if YOU choose to click Complete Work Item, This would remove the activity from the workflows and hence, no reminder mail would be there.
Ø 5.4.3 - To check for the Reminder Mail, wait for 10 minutes. Go to INBOX -> UNREAD DOCUMENTS. Here we can see the Reminder mail.
Here we find that our Workflow Scenario is complete.