Thursday 18 October 2012

SAP Business Workflow

Finding answers to the queries stemming out from the mind which may be related to any field acts as the building blocks to gain knowledge. Few questions rose in my mind too when I was going through the workflow training. Let’s answer some basic queries related to SAP business workflow.

What is Workflow?

Workflow is a tool provided by SAP to automate the complex business processes. Workflow ensures that the right work is sent to the right person at the right time in the right sequence with the right information. Basically Workflow provides answers to questions like what to do (Object), to what (Task), when to do (Event), who has to do (Agent) and in what order (Workflow Definition) the work has to be done.

How Workflow can be Started/Triggered?

Workflow is triggered by an event. Once the workflow gets started, it will call the Tasks associated with each step types in the workflow. Then the Task intern may call Methods defined in the Object and the Rule Container to determine the Agents Dynamically. Let’s put it in a simple way

Event --> Workflow --> Task --> Method --> Rule

What are the different layers in Workflow Engine?

There are 3 layers in the Architecture of Workflow Engine:
  • Business Object: Business object (BO) is basically collection of Attributes, Methods and Events for a particular business entity. Example of BO: Sale Order, Vendor, Customer, Material etc.
  • Business Process: Business processes are defined in Workflow builder. Each and every small work process is called as an activity in the workflow builder. Each activity consists of a single step task, which can be a standard task or a workflow template.
  • Organization Model: Organization model mainly has four important elements: Org unit (O), Job (C), Position (S) and Person (P). Rules and the Tasks are used to map these elements to the different agents.


What is Business Work Place?
Business Workplace is the interface between the user and the workflow system. It’s just like our regular mailbox but with some additional features. It is the place where we receive the Work items, Notifications, Documents etc. once a particular workflow is executed.

We can perform various functions in the workplace such as updating the work list, execute the work item, display workflow log, reserve or replace the work item and many more.

We can customize the Business Workflow as per our need and can add up to six dynamic columns through the transaction SWL1.

We can maintain substitution (assigning your work to other agents) in two ways: Personal substitute (for an SAP user) and Position substitute.

How Process, Business Logic and People are linked in Workflows?
  • The business processes are defined in Workflow builder. Each and every small work process is called as an activity in the workflow builder. Each activity consists of a single step task, which can be a standard task or a workflow template.
  • Associated Business Logic is built in Business Objects. i.e. ABAP code will be in Business Object. Business Objects consist of attributes, methods and events. Methods consist of ABAP code. Each and every standard task is associated with a Business Object and a method.
  • People / Group of people responsible for taking actions are defined in organization structure. Person responsible for taking an action is called actual agent. It is defined in the workflow activity.

Who is an Agent?
An agent is a person or a group of persons who can take an action during workflow runtime. Action can be approval of some business document, creation of some document or sending email.
There are basically three types of Agents:
  • Actual Agent: One who actually takes the action. This is provided in the workflow Activity.
·         Possible Agent: All possible persons/entities who are authorized organizationally to start a task and execute the relevant work item.
A single-step task cannot be processed as a work item if there are no possible agents. The possible agents always form the set from which the selected agents are determined.
It is not necessary to specify the possible agents of a single-step task if the respective task has been classified as a general task.
The possible agents of a multistep task are those employees in the company who are authorized to start the respective task in dialog.
A work item which is displayed via the workflow outbox, workflow log, or selection report can be executed by its possible agents (not only by its actual agents).
  • Excluded Agents: Persons who are excluded from taking action on a task. These are assigned in the workflow definition at the workflow activity.
Excluded agents are determined at runtime so that information from the environment for executing the workflow (agent for previous steps) or from the context of the processed application objects can be taken into account.

System checks Actual Agent defined in workflow runtime with the Possible Agents defined in the task and the Excluded Agents. Actual Agent should be a subset of Possible Agents minus the Excluded Agents, else Agent resolution fails.

Rules to Determine Agents?

The possible rules to determine agents are:
  • Responsibilities: It’s a pure configuration, no ABAP code only defined value ranges are assigned to agents.
  • Organizational data: It’s also configuration, no ABAP code is required. SAP Organizational Object Types are used to assign agents.
  • Function to be executed: ABAP code we can develop each function module required.
  • Organizational attributes (OOAW): You can use organizational attributes in the SAP applications EBP and CRM.

What are all the Different ways of creating Events?

Events are actions that occur in the system and that acts as trigger point for any workflow. Example:  Creation of Sales order.
The possible ways of creating events are:
  • Through Function module - SWE_EVENT_CREATE or SAP_WAPI_CREATE_EVENT
  • Change documents (SWEC) - When change documents are written
  • General Status Management (BSVW)-. Event creation upon status changes
  • Message control(SWUY) - Event creation as message type (SE91)
  • Logistics Information System (AWUW) - When an exception situation occurs (LIS exception)
  • Business Transaction Events (SWU_EWBTE) When financial documents are being created.
  • HR Master Data (SWEHR1/2/3) - When HR master data changes

How many Types of Tasks?
Task defines the Activity step defined in the workflow. Workflow tasks are assigned to the user when the associated workflow rules are trigged. Basically there are two types of tasks:
·         Single Step Task: This include Standard Task (TS – Cross client/time independent) and Customer task (T – Client Specific/time dependent)
·         Multi Step Task: This include Workflow Template (WS– Cross client/time independent) and Workflow Task (WF– Client Specific/time dependent)

What are Step Types?

A step types are the entities used in the workflow which gives the predefined results whenever executed.
The Step Types appear in the Objects section of the workflow builder or simply right click on the builder and choose insert option. Step Types that can be inserted in the workflow are:
Activity, web activity, Send Mail, Form, User Decision, Document from Template, Condition, Multiple Condition, Event Creator, Wait, Container Operation, Process Control, Loop(Until), Fork, Block, Local Workflow etc.

What is Deadline Monitoring?

Monitoring the workflow steps according to our predefined schedule is referred as Deadline Monitoring. We can monitor the workflow steps in four ways:
·         Requested start – Workitem is not available in the inbox until the predefined schedule is reached.
·         Requested end – Minimum time on task.
·         Latest start – Workitem must be started by predefined schedule.
·         Latest end – Workitem must be completed by predefined step else deadline missed message will come for the particular workitem.
Can we customize the Workflow?
Yes we can customize the workflow based on the requirement and we can do this through SWU3 transaction code which covers all the activities that concern the technical basic settings.

What are the possible runtime problems occur in Workflow?

The Possible runtime errors that can occur are:
·         Agent determination errors
·         Buffering errors
·         Work item errors
·         Event linkage errors

Different Terminologies used in Workflow?

Workitem: It’s a runtime representation of task or step defined in workflow. There are many types of workitem but only three type of workitem appear in the business workplace (Inbox). Type W (Work item with dialog), D (Deadline Missed) and A (Work Queue).

Delegation: It’s a process of creating sub type from the super type by inheriting all the properties of super type and adding your own methods, events and attributes to your sub type.

Container: It’s a storage place where all the values associated with variables or structures are stored (import or export).

Binding: Assignment between the elements of two different containers (Event Container/ Workflow Container/ Task Container/Method Container/ Rule Container)  is referred as Binding.

Basic Function Modules in Workflows?
SWW_WI_POPUP_FOR_COMPLETION - Shows the completed status of a workflow
SWW_ADDR_KEY_CREATE_FROM_USER - Display the address of the user or recipient
SWW_WI_DELETE - Delete work item
SWW_WI_CREATE_VIA_EVENT - Create work item as result of event
SWW_WI_DEADLINE_CHANGE - Change of deadline attribute of work item
SWW_WI_COMP_EVENT_RECEIVE - Complete workitem using events
SWW_WI_REJECT - Reject work item
SWW_WI_EVENT_RECEIVE - Retrieve event for a workflow
SWW_WI_DISABLE - Lock workitem against execution  
SWW_WI_ENABLE - Remove lock against execution of workitem

T-Codes related to Workflow?
SWLD - Lists all the transactions associated with Business workflows. 
SWDD - Main Workflow Builder.
SBWP - The Business Workplace SWDM - Business Workflow Explorer
SWU3 – Workflow Customization.
PPOC – Organization Maintenance.
PFTC - General task Maintenance.
PFAC – Rule Maintenance.
SWO1 - Business Object Builder.
SW06 - Delegation
SWEL/SWETYPV - Display/Maintain Event Type Linkages
SWELS -  Switch Event Trace On/Off
SWUS - Test Workflow
SWUI - Start Workflow
SWPR – Workflow Restart after error.
SWPC – Continue Workflow  after System Crash.

SWWL – Delete Workiiem.
SWI1 to 8 - Workflow Analysis.
T-Codes related to Task:
PFTC_INS - Create
PFTC_CHG - Change
PFTC_DIS - Display
PFTC_COP - Copy
PFTC_DEL - Delete
T-Codes Related To Events:
Events Creation
BSVW - Status management
NACE - Message Control
AWUW - Logistics Information System (LIS)
Event Linkages
SWB_COND - Workflow Start Conditions
Work item analysis:
SWI2_FREQ - Work Items per Task
SWI2_DEAD - Work Items with Monitored Deadlines
SWI2_DURA - Work Items by Processing Duration
Background Jobs:
WF-BATCH: Default background user (Not a T-Code)
SWWCOND: Work item rule monitoring.
SWWDHEX: Work item deadline monitoring.
SWWERRE: Work item error monitoring.
SWWCLEAR: Clearing tasks in the workflow system.
SWEQSRV: Managing the correct processing of the event queue.



@Regards,
Syed Nasir
 


Documents:










Tutorials:





References:











Monday 15 October 2012

Woh Sirf Maa Hai...

This is my first blog post and I want to dedicate it to all the beautiful, lovely, and caring mothers who leave no stone unturned to put their children on the right track, who can handle both Protagonist and Antagonist roles very well just to mold and give better shapes  to their children’s  life...

Labon pe jiske ho har hamesha duwa apne bacchon ke liye…
Woh Sirf Maa Hai…
Bhulay jo apne sajne-dhajne ko apne bachon ki zindagi sawarne ke liye…
Woh Sirf Maa Hai…
Daray na jo khud ke jalne ko apne bachon ki zindagi me kamiyaabi ki shamma jalane ke liye…
Woh Sirf Maa Hai…
Bina kahe jo samjhe apne bacchon ki har pareshaniyon ko…
Woh Sirf Maa Hai…
Rakhe jo dil ke khareeb aashiyana banakar har hamesha apne bacchon ko…
Woh Sirf Maa Hai…
In lafzon ki haisiyath hi kya jo kar sake bayan Maa ki fazeelath ko…
Tu dikhani hai soorath apni Khuda ko…
Rakhna hai Khush hamesha apni Maa ko… :-)