Brief Overview of Workflow Step-Types
This WIKI will help the readers to know more about the Step-Types that are used in Workflows and a wide Implementation of these Step-Types. Apart from sending mails, Workflows can handle a lot many affairs. This will clear the air that Workflows are generally used for sending mails.
Workflows can work like Algorithms in the background as well as Foreground to make the task appear in a Flow, Basically like the Flow of Work. Various Functionalities can be Implemented like, Flow based on calculations, Flow based on Conditions, Flow based on Conditional Events, Uploading Documents, Filling up Forms etc.
Container Operation is a Step-Type that is used for calculations with the help of Workflow Containers.
This Step-Type is used to derive various Arithmetic calculations from the Workflow Elements. To implement this Step-Type, we should give an Arithmetic Condition, based on whose result the WF moves further.
The various Arithmetic functions available are:
One should create 3 WF Containers, for example:-
C = A + B (where all these 3 should be WF Containers)
Result Element = Source1 [(Operator)] Source2
Here the Source and the Target Elements should be the Workflow Containers.
The Outcome of this Step-Type would be Numeric/Decimal always with 1 value.
This Arithmetic Operations take place between the values of the Workflow Containers.
These WF Containers can have Dynamic values as well as Hard-Coded values from the WF Container.
Multiple Conditions is a case that is implemented where we have to check so many conditions at 1 time.
Multiple Conditions can be implemented in 2 ways:-
If the condition is like this:-
If name = 'ABC'
* * Else if name = 'XYZ'
* * Else if name = 'PQR'
* * Else
In this example ()name should always be defined as the Workflow Container Element. The values that we pass to this WF Container Element using Binding are the Actual Values that we look for Comparison.
Number of Values for Comparison = Number of Branches from the Multiple Condition Step-Type
There are 3 conditions to check the name, so now we have 3 branches that will separately process each of the Condition being implemented.
Loop is a condition that is used when one has to check for a particular Condition being FALSE or TRUE. Here we can put any Condition involving 1 or more than 1 Container Elements.
If the Condition gets satisfied, the Loop Continues or else if the Condition goes False, The Loop Terminates and Moves on to the Next Element in the WF's.
Process Control is a very important Step-Type, since it performs a lot of Functions.
Now let us look at each of the Functions individually.
Cancel Work item
The process control step should be located in the branch of a parallel section. To uniquely identify the work item to be canceled, we must enter its node number in the 'workflow step' field. Press F4 to find all possible entries for the node numbers.
The work item selected is set to the status logically deleted at the time of step execution. The workflow is not continued after this work-item. It terminates.
Using this function, all work items of the workflow are set to the status logically deleted. If the step Process control is located in a workflow that is used as a sub workflow, the branch of the calling workflow that contains the sub workflow is stopped.
Set Work-Item to Obsolete
Use this Function, when process control is located in the branch of a modeled deadline monitoring. We can then set the work item that has exceeded its deadline, to the status completed and continue processing in the branch processing obsolete. In order to uniquely identify the work item to be cancelled, we must enter its node number in the field workflow step. Press F4 to find all possible entries for the node numbers.
The work item selected is set to the statuscompletedat the time of step execution.
Using this function, workflow work items are set to the status completed. If the step process control is located in a workflow that is used as a sub workflow, the calling workflow is continued. For Details of Sub-Workflow or Local Workflow.
Cancel Workflow (Including all Callers)
Using this function, all work items of the workflow are set to the statuslogically deleted. If the step Process control is in a workflow that is to be used as a sub workflow, the calling workflow as well as all the work items in it is set to the statuslogically deleted.Thewholeworkflow is stopped using this function.
A correlation enables us to identify objects that belong together. If we have defined a correlation by using the correlation editor (Environment->Development->Correlation Editor), we can activate it here. It can then be used in a wait step.Choose the event that the correlation is to be activated for, and the correlation to be activated. Specify how the value of the correlation is to be determined:
- BasisElement: If we have defined the binding in the definition of the correlation, we can specify a container element that references the corresponding basis element from the correlation definition.
- Binding: Choose this entry if we want to define a binding between the Workflow container and the correlation container.
In the fieldCorrelation Instance, choose the container element for the correlation object.
The correlation object shows the value of the correlation. The containerelement for the correlation object must have the predefined data type CL_SWF_MOD_CORRELATION.
Here we can trigger local events of typeException.
We can define a local event or an exception in the version-specific basic data of the Workflow. We define the exception handler in the block.
We define local events in the version-dependent basic data of the Workflow.
Give a name to the Local Event created; here the name is'New LocalEvent'.
A local event can be the following:
- An exception that is triggered by a step of typeProcess Control. You define the exception handler in the block.
- A local event that is triggered by an event controller or an event. You can use a local event to start a local Workflow. Furthermore, a step of typeWait for Eventcan wait for a local event.
Wait Step-Type is used when we need to wait for either an Event to happen or a Condition to get satisfied, so that we can proceed further with the Workflow.
There are 4 conditions on which WAIT works:-
C: Wait for Condition
L: Wait for Local Event
W: Wait for Event by Using Workflow
Wait for Event.
Let us see these individually.
C: Wait for Condition
The wait step is complete once the specified condition has been fulfilled.
L: Wait for Local Event
This step enables us to stop the execution of this branch of our Workflow until a local event has arrived.
Wait for Event
- With this step, we stop the execution of this branch of our workflow until a defined event for a particular object occurs.The object for which an event must occur must be in a container element of the workflow container. Enter the desired container element and select an associated event. We only have to define a binding if we want to use the data of the event in the workflow.
We should not use this step type in a fork to wait for an event that is triggered in another branch of the same fork.If the event arrives, it completes all wait steps that are waiting for this event.
W: Wait for Event by Using Workflow
- When waiting for an event using Workflow, the event is initially received by the Workflow and transferred to the next step, as soon as it is active.
When waiting using Workflow, an event can complete a maximum of one wait step. If more than one wait step is active, the event completes the oldest wait step.
This Step-Type is generally used when we need parallel processing which may or may not be based on any condition. Specifying a Condition is not mandatory for a FORK to work.
The number of Parallel Branches specifies that these many are the ways for parallel processing.
This Event Creator step type is used when we have to implement a BO Event or a local Event after the WF has started.
For this event Creator Step, the event must be defined for the BOR object type or class and a container element must exist in the workflow container, which refers to this BOR object type or class. Enter the required container element and choose an event. Do the necessary Binding.
We can use this event to, start or continue another workflow.
After this Event Creator, you can implement a Local Workflow to Start based on this Event Triggering Condition.
After Implementing This Step-Type, the next step would continue only when this Event is created in the Application. Until and unless, this Event is satisfied, WF won't continue from here.
Document from Template
The step type 'Document from Template' enables us to create documents in Workflow with different PC applications. These documents are based on a template that we create with the PC application when we define the Workflow. This template can reference elements from the Workflow container. We can display and edit templates created in this way throughout the Workflow.
The Different PC Applications are:-
One must have saved the Workflow to be able to create a template.The receiver of the Workflow must have installed the PC application locally on their PC to be able to execute the work item. When the Workflow is executed, the template is opened in the relevant PC application and can be completed there. The document is then saved in a container element in the Workflow container.
How to create a Document Template?
Choose this Step-Type.
A workflow Container named WF_DOCUMENT_001 automatically gets created. Click on 'CREATE'.
Select one of the Options.
After Selecting a PC Application, The system fields and the container elements of the workflow container are offered for selection in the navigation area. They can be transferred into the template by double-clicking.
Select to assign a name for the document template and SAVE the Document template. Now Execute the Workflow and it gives us the Option to select from the various Templates Created. The Container Fields that we have inserted in our Template gets replaced by the Run-time Values.
Select the Document that you created and find the runtime values.
We can use a form to display or edit data of a container element of the workflow container that refers to a structure. We can use all the fields in the structure in the form. We can use a wizard to generate the form we need and we can edit the generated form and make our individual settings.
Depending on the action chosen, the form is displayed in either display or edit mode when executed. Additional pushbuttons are generated for the approval actions. As well as the form, the workflow toolbox is automatically available in execution.
How to create and use a FORM?
Create a WF Container – the Type of which you need the FORM to be. Select the FORM Step-Type there.
Click on CREATE.
Click on CONTINUE.
Click on CONTINUE.
Click on COMPLETE.
Form Created Successfully.
The FORM Format.
Now Execute the WF.
The FORM opens up for you to fill. Just Fill the FORM and Press SAVE AND EXIT Button.
After you press the SAVE AND EXIT Button, the data gets saved in the required table from which the WF Container was made: - CRM_ORDERADM_I in this case.
In a local Workflow we can model a part of the Workflow that is started by a local event.
In this Local Workflow we should create our own Workflow Container Elements, called as Local Containers. These additional container elements are then available to all steps that belong to this local Workflow and can be filled from the Workflow container by either an initial value or a binding.
We only need to define a binding if we want to use the event data in a Workflow. We must set the import indicator for local container elements that are filled by a binding from the Workflow container to ensure that the binding can be traced.
Within this Local Workflow you can still create some more WF Steps, so that this should act as a Sub-Workflow for the original WF in which this Local Workflow was created.
Create a Send-mail Step in this Local Workflow:-
Right Click on the Down Arrow for Local Exception, and Click Create. Select the Send-Mail and enter the values.
The Local Workflow Looks like this:-
Implement this Local Workflow after the Event Create Step-Type and see the Effect. This Local Workflow will trigger for the Specified Event happening after the start of the original Workflow. In the Event Creator Step-Type, Use the Local Workflow as the Event Creator: - TRIGGER LOCAL EVENT.