Workflow Step by Step
Scenario • When any PR has been changed a workflow will be triggered which requires approval depending on its PR value. If the PR value is less than 1000 it will auto release the workflow to the PO creation step and if it is more than 1000 then it will move forward for approval. The approval mail will reach in the SAP inbox of the three user mentioned in the work flow. Out of them if any two approves the PR it will move forward to the next step and a PO will be created with PR reference.
STEPS INVOLVES
• Configuration
• Building Workflow
CONFIGURATION Checking Change Documents Configuration
BANF change document object will keep the log of the change of any field in the table EBAN & EBKN, You can add more checks also
Defining Workflow Property
LINKAGE •In this step linkage will be set up between the change document objects and the BOR and the Method.
You can put Field Restrictions inside it also.
So any change in EBAN table will trigger this event by this linkage
EVENT Linkage •In the event linkage step, linkage between BOR, Workflow and the Method has been set up.
Building Workflow
PICTURE of the WorkFlow
STEP 1 The first step to build up a workflow is to understand the business logic (BO) behind it. Here for our purpose we have found one business object. We have copied that BO into a customize one as we need to create more methods and the events. To find the BO, transaction- SWO1
Our BO is BUS2105. We have copied it into ZBUS2105. There we have created few methods. Like Determine PRVal, CreatePurchaseOrder etc. You need to write code for the method.
STEP 2
In the next step you have to create a task as workflow template. After giving the required entry, you have to save it under a package. And activate it.
STEP3 (Workflow Buider)
•In the next step go to the transaction SWDD( Workflow Builder) The following screen will appear after giving the workflow name.
Activating the EVENT
Activate
STEP 4(Task Creation) According to our need as this step will do the PR Value check, so we have created a Standard Task
Don’t forget to click on the Background Processing Button. As this task will take place in background. Otherwise you have to assign an agent to that task.
STEP/TASK Container Variable
In the container section we can declare the step/task variable which will be used to collect data from Workflow container pass onto Method and after processing inside the method again the values are passed to the workflow container variable via these variable.
STEP5 (Creating Activity)
In our example the next step is to determine the PR value, which will help the workflow to guide in right direction of approval. In the Determine PRVal task you need to first create an activity , So after right click at the required point you will find the following box, select ACTIVITY from the box.
Adding Task to WorkFlow
BINDING
Creating Condition Box Inside the Condition Box
As thereis two outcome mention as TRUE/ FALSE so branch has been created. Now in the approval needed section we will add the FORK
STEP6 (Use of FORK) Inside the fork
As we need to pass the information of PR changes to three approver so we have mentioned Parallel Branches as 3. In the end condition we have given it as 2. It means if any of the two approver approves it the FORK operation will come to end and the next step of the workflow will be executed. For each branches of the FORK we have mentioned almost similar criteria except the approver name.
The Parallel branches of the FORK will look like as below.
STEP7 (Decision Box)
We have given the Title as Approve/Reject PR &1 and the user as PWCIN. i.e. in the user Inbox he will receive the above message. &1 will take the value of the parameter 1.
AGENT
In addition to it we have also given two decision text as Approve Reject.
For which the following two branches have been created.
AGENT Assginment In the Control section of this step there is Method assign to it similarly via a task as we did in the earlier case.
Donot Check the Button. As this step is in dialouge mode and it needs approval.
In the outcome section check whether the decisions are activated or not
STEP9 (Approve) Now in the approve section we are adding another TASK, where a method name AUTHORIZE is linked up.
Here we have assign one agent as PWCIN. So PWCIN has the authority to approve the PR. In this task we have not check the Background Processing field.
STEP 10 (Delete)
STEP11 (PO Creation) We are passing the PR number inside this method and getting the PO num.
PO Creation Method Here PR number is passed to the ZTEST_FM_PO function module and from there PONum value is returned
Monitoring SWI1 is the transaction by which we can monitor the progress of a workflow.
Workflow Log
Monitoring List with technical details
Graphic Workflow Log
Graphic Workflow Log
Work Item Content