You are on page 1of 50

1. Difference between Rule and Role Rule A Rule is a general way to 'define' your agents.

A rule is maintained with Transaction code PFAC and is used to programmatically define the agents. For example, if you want a work item to go to all managers who worked for the company for 5 years or more, then you would have to create a rule that handles this custom scenario. Typically this is done by creating a custom function module that performs your selection logic and passes the results back to the rule. You can define a container element that contains the object of Organizational Management at runtime or a rule for dynamic agent determination.

Role A Role is a general way to 'assign' your agents.


A role is maintained with Transaction code PFCG and is usually assigned to a User (someone with a valid login). For example, you can have the role of ABAP_DEVELOPER and assign this role to all users who are developers. This is a good method to use if you want ALL developers to receive a workflow work item.

You can specify not only a system user, but also a role or an object of Organizational Management such as a position, a Job, an organizational unit or a work center.

2. Difference between BAPI and BOR.

3 .How to assign general task? what is the use of general task?. In the agent Assignment attributes we will assign a general task Use of General Task:- you determine that all users can perform this task (in workflow).

General Forwarding Allowed


This indicator determines that work items assigned to this task can be forwarded to all users, even if the task has not been assigned to the user.

General Forwarding Not Allowed


This indicator enables you to determine that work items for this task can only be forwarded to users who are agents for the task. If this indicator is not set, a work item for this task can be forwarded to all users.

Forwarding Not Allowed

Classification of task
Tasks can be classified into various different classes. Tasks are classified as 1.subject matter, 2 personal, 3. disciplinary or are not assigned to any class at all.

Task Properities. Agent Assignment Background Assignment Task Complete Confirm End of processing

3.

what is mean by agent assignment? Indicator denoting that the referenced single-step task has possible agents assigned to it.

Possible agent:- User who is authorized organizationally to start a task and execute the relevant work item.

List of Agen types:1. 2. 3. 4. 5. 6. 7. 8. 9. Expression. Rule Organizational Unit. Job Position Workcenter User Workflow Initiator Superior of workflow Initiator

4.

Define Substitutions and different types of Substitutions?

Substitutes are essential so that a users work items can be seen and executed by a defined replacement user. This ensures that work is not left unattended if someone is out of the office unexpectedly. Below are details of the different kinds of substitutes

Passive Substitution If Passive substitution is used then the substitute (User B) only sees the work items of User A. User A sets up the substitution but does not activate it, then User B can Adopt the substitution if User A is out of the office unexpectedly. (As of NW04s SP04 a new setting in customizing enables you to define which work items a substitute sees when they adopt a substitution (passive substitution). If the setting is set, the substitute sees both their own work items and those of the absent user. If the setting is not set (default setting), the substitute only sees the worklist of the absent user. Active Substitution Active substitution (for example, for absence due to vacations): In this case, the items belonging to the absent person are automatically assigned to the substitutes inbox (in addition to his own work items). If active substitution is used then the substitute will see their own as well as the agent they are substituting for. Active substitution is where User A is going on vacation and specifies User B as their substitute and activates the substitution.

Positional or Personal substitution


When you specify Positional substitution you can only see work items of a user that have been assigned to that position. When you use Personal substitution (Direct substitution) you can view your own work items plus all the work items of the other user (Whether they are assigned to a position or not).
5.

Dynamic parallel processing in SAP Workflow

Sometimes we need to process a dialog step (activity) several times in parallel and we may not be aware of how many times exactly this step has to be processed. Consider this scenario: For a sales order, we need to check the available quantity of the line items (materials). For each value of this list, a particular function has to be performed. So we need to create different work items for each material. This is called dynamic parallel processing, since the number of line items is known only during runtime. To achieve this, follow these steps: 1. We need to define a multiline container for the material. 2. Go to "Others" tab of the dialog step (activity) 3. Enter this workflow container element on this tab. Restriction : The multiline element should not contain more than 99 values. At runtime, the workflow system generates from the step as many parallel work items as there are values in the multiline container element at that time. The number of values need not be known at definition time. If the table is empty, this step is ignored.

Define Binding? Binding editor is used to define binding between elements of different containers Points to be noted while defining binding between elements of different containers,

Elements should belong to same data type. Binding can be defined between compatible data types.

What is mean by Workflow Container. 5 different containers in workflow:


1. 2. 3. 4. 5. Workflow container Task container Method container Rule container Event container

Workflow container: a. b.

Binding can be defined from Workflow to Event Container. Binding can be defined from Workflow to Task Container.

c.

Binding can be defined from Workflow to Rule Container. Binding can be defined from Event container to Workflow Container. Binding can be defined from Event container to Task container.

Event Container:
a. b.

Task Container:
a. b. c.

Binding can be defined from Task to Workflow container. Binding can be defined from Task to Rule container. Binding can be defined from Task to Method container.

Method Container: Binding can be defined from Method to Task container and method container. Rule Container: Binding can be defined from Rule container to Workflow container.

How to customizing the business object?

How to activate the workflow builder?


To set the workflow definition to status active, you select . The workflow definition is first subjected to a syntax check. Any errors and warnings discovered are displayed in the message area of the Workflow Builder. Only if errors are found, is the workflow definition not activated. If no errors are found (no red traffic lights in the message area), the workflow definition is saved and activated.

Define Rule and its types?

The rule container contains a rules parameters. Each rule has just one rule container. At runtime, the rule parameters contain the current, context-specific information that forms the basis of rule resolution. Therefore, the rule parameters constitute "input" for rule resolution. In SAP Business Workflow, binding feeds the rule parameters with values from the workflow container. If a task contains default rules, the system fills the rule container from the task container using binding. If a rule is used in a workflow to determine the responsible agent, the result of rule resolution is stored in the container element _RULE_RESULT and can be transferred to the workflow container by binding.

Standard Rules.
1 2 A rule container is defined for each rule. The rule parameters determine which information is required for the rule resolution to be executed at runtime. 1 If an error occurs during rule resolution, setting the termination indicator for the rule resolution determines how the workflow will continue: Flag is selected - the workflow assumes an Error status and a notification is sent to the workflow administrator. Indicator is not activated - the workflow forwards this work item to ALL possible agents.

Rule Resolution
Use The following types of Rules can be resolved: Agent determination rules

Agent determination rule is used in SAP Business Workflow for example, determine the responsible agents of a work item who have certain characteristics. WebFlow Rules WebFlow rules are used within a workflow in the basic data and in the Web activity step type. Using a WebFlow rule you can individually execute the following parts of a Web activity: 1 2 3 4 5 Determination of URL Preparation of the XML document Determination of the authentication data Execution of the send procedure Determination of transfer format

How to restart the workflow? Go T-code SWPR Tick the check box restart immediately. If there is no error in the workitem 1.go to tcode SWUS_WITH_REFERENCE

2. give the work item id and then execute. Even the new workflow has been created, but the old workflow is still in the same status, so you need to logically delete the old workflow. You can do it via two ways:1. SWW_WI_ADMIN_CANCEL execute the function module.

Here give the workflow instance (ID) of old workflow and execute. And the new status will come as status in the execution output:-

Check the workflow logs of the old workflow, which will now show the status Logically Deleted:-

2. Go to transaction SWI1, enter workflow instance (ID) of old workflow and execute:-

In the output, select your work item line and click on log button:-

In the logs, double click on the first line in workflow logs:-

Then on the next screen, click on Change option in Edit menu:-

On the next screen, click on Execute button for Logically Delete option:-

Below pop-up will appear, confirm it:-

The work flow gets deleted:-

Check the old work flow logs, which will now show the status Logically Deleted:-

Related T-codes in workflow

saction code

Path from area menu SAP Business Workflow (Development) Wizard for event creation Workflow Information System Definition tools Event creation Set up with wizard Reporting Workflow Information System Event Creation

AWUV

MCA1

Workflow Information System (WIS)

(WIS) OOAW PFAC PFAC_CHG Evaluation paths Maintain standard role Change roles Definition tools Standard roles Change Definition tools Standard roles Delete Definition tools Standard roles Display Definition tools Standard roles Create Definition tools SAP org. objects Create assignments Definition tools SAP org. objects Display assignments Making Links in PD Organizational Management Role Definition

PFAC_DEL

Delete roles

PFAC_DIS

Display roles

PFAC_INS

Create roles

PFOM

Maintain assignment to SAP organizational objects Display assignment to SAP organizational objects Organizational environment of a user Maintain customer task General task maintenance Change tasks

PFOS

PFSO PFT PFTC PFTC_CHG

Creation and Processing of Tasks Definition tools Tasks/Task groups Change Definition tools Tasks/Task groups Copy Definition tools Tasks/Task groups Delete Definition tools Tasks/Task groups Display Definition tools Tasks/Task groups Create

PFTC_COP

Copy tasks

PFTC_DEL

Delete tasks

PFTC_DIS

Display tasks

PFTC_INS

Create tasks

PFTR PFTS PFWF PFWS PPOC

Standard task for transaction Standard task Maintain workflow task (customer) Maintain workflow template Create organizational plan Maintain organizational plan Display organizational plan Ongoing settings Workflow editor administration data Business Workflow Explorer Display and maintain event type linkage Display instance linkages Switch event log on/off Link change documents to events Definition tools Organizational plan Create Definition tools Organizational plan Change Definition tools Organizational plan Display Administration Settings Customizing, part of ongoing settings Definition tools Business Workflow Explorer Utilities Events Type linkages Utilities Events Instance linkages Utilities Events Event log On/off Definition tools Event creation Change documents Linkage Definition tools Event creation Change documents Define workflow properties Utilities Events Event log Display Definition tools Wizards Workflow

Simplified Definition of Standard Tasks

Enterprise-Specific Organizational Plan

PPOM

PPOS

SWDA SWDC

(Ongoing) Settings Workflow Editor Administration Data Maintenance Functions of Business Workflow Explorer Type Linkage Table Maintenance Instance Linkage Evaluation Event Log Creation of Events When Change Documents Are Written

SWDM

SWE2 SWE3 SWE4 SWEC

SWED

Assignment of change document objects to object types

Maintenance of Workflow-Relevant Settings for Change Documents

SWEL SWF3

Display event log Workflow Wizard Explorer

Event Log Workflow Wizard Explorer

Wizard Explorer SWF4 Workflow Wizard Repository Selection report for workflows Work item analysis Workflow outbox Task analysis Workload analysis Object links Workflow resubmission folder Error overview Definition tools Wizards Workflow Wizard Repository Utilities Work item selection Reporting Work item analysis Runtime tools Workflow outbox Reporting Task analysis Reporting Workload analysis Runtime tools Object links From integrated inbox or workflow outbox Part of administration of workflow runtime system (transaction SWUF) Customizing, part of ongoing settings Utilities Consistency check Organizational assignment Workflow Wizard Repository Selection Report for Finding Work Items Work Item Analysis Workflow Outbox Task Analysis Workload Analysis Object Links Workflow Resubmission Folder Error Selection

SWI1 SWI2 SWI3 SWI4 SWI5 SWI6 SWI7 SWI8

SWL1

Settings for dynamic columns Check tasks for agents

Defining Dynamic Columns for Integrated Inbox Display Organizational Assignment

SWLC

SWLD

Workbench for Workflow 4.0 Copy plan version Maintain work item views Workbench for Workflow 3.0 Business Object Builder Customizing object types Definition tools Business Object Builder From Business Object Builder, choose Customizing, part of ongoing settings

Area Menu SAP Business Workflow (Development)

SWLP SWLV SWLW

Views Area Menu SAP Business Workflow (Organization) Business Object Builder

SWO1

SWO6

Adapting Object Types on a Customer-Specific

Settings Delegate System-wide SWU0 SWU2 SWU3 Event simulation RFC monitor Customizing consistency check Consistency check for standard tasks Utilities Events Simulate event Utilities Workflow RFC monitor Utilities Customizing Utilities Consistency check Task Standard task Utilities Consistency check Task Customer task Utilities Consistency check Task Workflow task Utilities Consistency check Task Workflow template Utilities Technical trace On/off Utilities Technical trace Display Utilities Diagnosis Utilities Events Generate event Administration Runtime system Definition tools Workflow start transactions From the R/3 initial screen, choose Office Start workflow SWUS Start tasks Runtime tools Start

Basis Simulation: Event Creation RFC Monitor Auto-Customizing and Consistency Check for Customizing Consistency Check for Tasks

SWU4

SWU5

Consistency check for customer tasks

SWU6

Consistency check for workflow tasks

SWU7

Consistency check for workflow templates

SWU8 SWU9 SWUD SWUE SWUF

Switch technical trace on/off Display technical trace Diagnostic tools Trigger event Runtime system administration Workflow start transactions Start workflows

Technical Trace

Error Diagnosis - List of Problems and Solutions Creation of an Event for Test Purposes Administration of Workflow Runtime System Definition of a Start Transaction for a Workflow Starting a Task in Dialog

SWUG

SWUI

Starting a Task in Dialog

workflow SWUY Wizard for message linkage to workflow Definition tools Wizards Create "Call workflow from message" Starting a Task From Message Long Text

SWX1 SWX2 SWX3 SWX4 SWXF

Create notification of absence Change notification of absence Display notification of absence Approve notification of absence Form applications: Access point Environment Demo examples Fill out form Demo Example: Processing a Notification of Absence

Dead line monitoring:

The runtime system allows the deadlines to be monitored for the execution of work items and the overall workflow. Dead lines can be set and monitored for the below steps in workflow activity, user decision and wait step.
Requested start The requested start is a technical setting and is implemented by the workflow system. Processing is not possible before this date. Latest start Start by Processing of the work The system uses the latest start, requested item must have started end, and latest end to monitor the progress by this date. of the work item and compares these dates with the current dates that result from processing the work item. The system triggers the actions described below if the work item has not been processed by these dates.

Requested end

Processing of the work item should have been completed by this date. Processing of the work item must have been completed by this date.

Latest end

The deadlines are always set relative to a reference point. This reference point can be

The creation date/time of the work item. The creation date/time of the workflow containing the work item. A date that is derived from the context of the application when the specific workflow instance is executed. This date is defined via an expression containing a reference to the workflow container.
If a deadline is exceeded, the activity/user decision involved has not yet been completed. Notification of the deadline agent or the steps following a deadline event are therefore carried out asynchronously and do not complete the original activity/user decision.

Workflow Steps: 1) Activity 2) Web Activity(not frequently used) 3) Send Mail 4) Form 5) User decision 6) Document from template 7) Condition 8) Multiple conditions 9) Event Creator 10) Wait 11) Container Operation 12) Process Control 13) Loop (until)

14) Fork 15) Ad Hoc Anchor 16) Block 17) Local Workflow

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
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: Multiplication Addition Subtraction Division One should create 3 WF Containers, for example:C = A + B (where all these 3 should be WF Containers) Result Element = Source1 [(Operator)] Source2

Note: 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
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:Case Switch

If the condition is like this:If name = 'ABC' Do this. * Else if name = 'XYZ' Do this. * * Else if name = 'PQR' Do this. * * Else Do this 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
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
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.

Cancel Work-Flow
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.

Complete Workflow
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.

Activate Correlation
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.

Throw Exception
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.

Local Event

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
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.

Fork
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.

Event Creator
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.

Form
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.

Local Workflow
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.