Workflows
Scenario1:
Purchase order workflow:
Step1:
How to find the Business Object for the transaction that we are going to process
Execute the transaction ME22N and change any values in it
Step2:
Go to transaction SWEL and see the trace for today
BUS2012 is the business object we have got for this transaction.
Sample Workflow
To send a mail to SAP INBOX to show the purchase order (ME23N) when any new PO
is created or changed.
The main aim of this example is to make use of standard methods available in
business object.
This workflow will be triggered while changing and creating PO. So, add the events
for creation and change in start event of the workflow.
The created and changed events for this are displayed below
Go to transaction SWDD to start creating workflow
Start Events have to be mentioned here
Basic Data
Give the workflow name and description
Go to start Events tab and give the object type name and Events name.
Click Active button in both the events to make this workflow gets triggered on PO
creation and changes
Save the workflow first !!!
Workflow number will get assigned automatically
Click Active button now. Activation is a customizing task.
SWETYPV
When the event gets activated, it will create an entry automatically in SWETYPV
transaction code.
NOTE: When workflow is not getting triggered, this is the first transaction you have
to look into.
BO name Events Our WF no.
What you need to check??!!
1. Whether the entry is there for this business object
2. Check whether Linkage activated is checked. Double click the record in the
transaction SWETYPV and make sure the check box Linkage Activated is
checked.
There was a method called Display in BUS2012 object. To call this method in
our workflow, we need to create a task.
Creation of task
1. Create task using transaction PFTC
2. Select Standard Task and press New button.
Type the Business object name and method
Write the subject line for the mail in the work item text. Append the PO
number that wil be created or changed using Insert Variables
Insert
Variables
Double click this to insert the PO number
Save the Task.
Task number will be generated
We are going to use this task in our workflow through a step type called
Activity.
Following are the step types available in workflow
Double click the undefined step.
Double click Activity
Write the task name that we have created here.
Once task name is entered, system will ask whether all the objects present in
the task will be binding to our workflow. We need some variables in workflow
to bind with those tasks variables. So, the system will also suggest the
variables that need to be created in our workflow. The new variables will be
created in a place called workflow container.
_WI_OBJECT_ID is assigned with business
object BUS2012 in task container
In workflow container, new variable will get created with
name BUS2012 of type BUS2012
Workflow Container
Check out the newly created Business object created automatically.
Double click this variable and activate the import parameter to receive the values
which are received while triggering the events.
Also check the BINDING in start events of workflow. This will generate the values
from BUS2012
Agents
We have to give the user name that the work item will go.
Give User name by selecting agent category as User
Enter the user name
Task Properties
We can set the possible agents in Agent Assignment. If we assign any number of
user names through Agent Assignment option, user can give only the user name
out of these names.
How to give possible list of agents who can perform this task??
Click this Pumpkin Button
It will show multiple agent types. Select any agent type. For our example, select
user and click continue.
Note : Transaction code for Agent Maintenance is PPOM.
Type User name PMUNIAPP
Like this add any more user names which are required.
If we dont want to restrict with any specified set of users list, make our task as a
general task.
To make any task as general task, click attributes button.
Select General Task and click transfer.
Background Processing
Agents are assigned for the particular task only if
Any user interruption is required or
Particular task needs to be performed only by the specified users
Usually, task can be set as background Processing when any background
calculations are need to be processed.
Tasks property needs to be changed to make the task as background task.
Select the option Background Processing while creating task (PFTC)
Now save our workflow and activate it
Testing Workflows
Execute the desired Transaction and test it
Go to SWUS and test it.
Execute the desired Transaction and test it
Go to ME22N and change an existing Purchase Order
Press Save
Open the work item
Test by SWUS
Go to transaction SWUS and enter the workflow number and PO number. This will
produce the output based on the last changes done to the transaction.
When you press F8, it will display the PO
Press Back.