Workflow Basic Training Jan-2007 2007 IBM Corporation
SAP Business Workflow - Basic IBM Global Business Services 2007 IBM Corporation 2 Jan-2007 Workflow Basic Training Question and Answer/Recap Hands on -Design workflow on Flipcharts and present to class. Class to be divided in 3 - 4 groups DAY4(4 hours) Basic Monitoring transaction(SWEL, SWI2_FREQ) Hands on (Raise Events and Rule as agent) Types of Agents Organizational Plan, Role Resolution (Responsibility + Function Module) DAY3(4 hours) Question and Answer/Recap Hands on (Create task and Workflow Template) Workflow Events (Change Doc and ABAP coding) Container and bindings Detailed discussion about the different steps involved in a WF Template Tasks DAY2(4 hours) Question and Answer/Recap Hands on (Create a Subtype and Delegate) Basic Business Object Program Business object overview Basic Workflow Template Workflow Architecture Introduction to Workflow DAY1(4 hours) TOPIC DAY IBM Global Business Services 2007 IBM Corporation 3 Jan-2007 Workflow Basic Training SAP Business Workflow SAP Business Workflow is a cross-application tool that makes it possible to integrate business tasks/processes between applications. This tool was introduced in R/3 Release 3.0A, and received a substantial facelift in the Enjoy Release, 4.6A,which warranted the new name Workflow Builder. IBM Global Business Services 2007 IBM Corporation Workflow Basic Training Need of Workflow Hmm ! Time to put in a Hmm ! Time to put in a purchase requisition request purchase requisition request 1 1 3 3 I guess Id better send off I guess Id better send off some inter some inter- -office mail to office mail to ask the approvers to ask the approvers to approve my requisition. approve my requisition. 2 2 I wonder who I wonder who approves buying this approves buying this stuff? stuff? 5 5 Time drags on . . . Time drags on . . . Meanwhile, in Meanwhile, in Mr. Managers office . . . Mr. Managers office . . . What shall I do next? What shall I do next? 4 4 TIME IS MONEY!!! TIME IS MONEY!!! IBM Global Business Services 2007 IBM Corporation Workflow Basic Training Drawbacks Inefficiency. Each lacks a way to trace where a task is. Who executed or is executing it. How much time it required. IBM Global Business Services 2007 IBM Corporation 6 Jan-2007 Workflow Basic Training Why SAP Workflow Workflow ensures that the right work is sent to the right person at the right time in the right sequence with the right information. Tool for the automization of business processes Not tied up to any paricular application Operates uniformly accross applications Coordinate all participating tasks Provide users with active support Intelligent routing IBM Global Business Services 2007 IBM Corporation 7 Workflow Basic Training How to use Workflow - (Common Examples) Workflow is best suited for document routing Example: If we want to route a candidates resume to a set of people Workflow is best suited for automating business process Example: If we want various Purchase Orders to be approved by heads of various department Workflow is best suited for participation in data creation by a collective set of people Example: Vendor address by front end, Vendor account by General Accounting Workflow should not be used solely for notification purpose Example: Send notification when a SO is created, Invoice is blocked etc. IBM Global Business Services 2007 IBM Corporation 8 Workflow Basic Training SAP Workflow- (BEST Business Practices) Improve Quality and Decision Making Deliver accurate information to Process Participants; both within the Enterprise and Externally; Ability to attach documents and Objects to a work item Improve Operational Efficiency Prevent duplication of effort; Pre-defined Business Process and Actors Eliminate time wasted waiting to take action . Ensure Compliance Monitor and Control Processes; Deadline Monitoring and Escalation Procedures Speed Time to Market Accelerate the execution of SAP Transactions by routing information quickly to users for immediate action; Ability to substitute; Ability to Forward Work Items IBM Global Business Services Workflow Basic Training Jan-2007 2007 IBM Corporation SAP Business Workflow - Basic Workflow Architecture IBM Global Business Services 2007 IBM Corporation 10 Jan-2007 Workflow Basic Training Workflow Architecture Organisational Level Organisational Level Process Level Process Level Business Object Level Business Object Level IBM Global Business Services Workflow Basic Training Jan-2007 2007 IBM Corporation SAP Business Workflow - Basic Workflow Definition IBM Global Business Services 2007 IBM Corporation 12 Jan-2007 Workflow Basic Training Workflow Definition Workflow definition consists of 1. Basic Data 2. Information about triggering events 3. Initial Values 4. Containers 5. Bindings A workflow definition describes the workflow process IBM Global Business Services 2007 IBM Corporation 13 Jan-2007 Workflow Basic Training Workflow Builder The workflow definition is created in the Workflow Builder and displayed graphically in a network. Transaction: SWDD Menu Path: Tools Business Workflow Development Definition tools Workflow Builder. IBM Global Business Services 2007 IBM Corporation 14 Jan-2007 Workflow Basic Training Workflow Definition - Steps A workflow definition is made up of individual modular steps. IBM Global Business Services 2007 IBM Corporation 15 Jan-2007 Workflow Basic Training Example: Workflow Definition IBM Global Business Services 2007 IBM Corporation 16 Jan-2007 Workflow Basic Training How are Workflows Created in a System Within workflow templates, there is a key with the following structure: - A WS task abbreviation for the workflow template - An 8-digit sequence number From the structure of the 8-digit number, the system knows whether the template is a standard template delivered by SAP or one created by the customer. Customer-defined templates start with the prefix number that was defined in Customizing for the system and client. IBM Global Business Services 2007 IBM Corporation 17 Jan-2007 Workflow Basic Training How workflow gets executed IBM Global Business Services 2007 IBM Corporation 18 Jan-2007 Workflow Basic Training Workflow Toolbox - SWUS Transaction: Transaction: SWUS. SWUS. Menu Path: Menu Path: Tools Tools - -> Business Workflow > Business Workflow - -> Development > Development - -> Runtime Tools > Runtime Tools- -> Start > Start Workflow (Test Environment). Workflow (Test Environment). IBM Global Business Services Workflow Basic Training Jan-2007 2007 IBM Corporation SAP Business Workflow - Basic Business Object IBM Global Business Services 2007 IBM Corporation 20 Jan-2007 Workflow Basic Training SAP Business Workflow has been developed on an object- oriented basis. The business object types are identified and described with their object methods in the Business Object Repository(BOR) of the R/3 System. Generally one object is created in the system and then processed in a workflow over several steps by various employees. Object Types & Workflow IBM Global Business Services 2007 IBM Corporation 21 Jan-2007 Workflow Basic Training Workflow deals with object types. Object types are definitions of data. In order to access database data, workflow uses the object type interface. Most of the information represented by object types is available in the ABAP/4 Dictionary. Objects are created at runtime and are specific instances of defined object types. Many object types are delivered by SAP. In addition, the customer can create new object types or extend SAP objects by creating subtypes (child objects). New customer objects or subtypes may be desired if the delivered SAP object does not contain all the characteristics (attributes) or processing options (methods) desired. Object Types & Objects IBM Global Business Services 2007 IBM Corporation 22 Jan-2007 Workflow Basic Training Object Type - Definition IBM Global Business Services 2007 IBM Corporation 23 Jan-2007 Workflow Basic Training Interfaces Interfaces are a combination of attributes, methods, and events to be used in common among multiple object types. The purpose of interfaces is to define common functionality in one object type, and to assign that common functionality via an interface to multiple object types across the Business Object Repository. This avoids redundancy of data and functionality definition. Each new object type automatically receives the interface IFSAP, the SAP standard interface. IFSAP provides every object type with the following: Method Display Method ExistenceCheck Attribute ObjectType IBM Global Business Services 2007 IBM Corporation 24 Jan-2007 Workflow Basic Training Key Fields Key fields are designed to uniquely identify the object type. If the key field has a data type reference of a dictionary table field, the runtime system will look to that table field to retrieve the value of the key when processing the object. When the key field is created, the ABAP/4 program code is generated automatically when the object type is generated. IBM Global Business Services 2007 IBM Corporation 25 Jan-2007 Workflow Basic Training Attributes Attributes provides access to data. ABAP Dictionary Field Virtual IBM Global Business Services 2007 IBM Corporation 26 Jan-2007 Workflow Basic Training Methods Methods incorporate the permitted functions available for an object. Methods have importing and exporting parameters as well as exceptions. Methods can be created using : IBM Global Business Services 2007 IBM Corporation 27 Jan-2007 Workflow Basic Training Methods Import Import Parameters Parameters METHOD METHOD R e s u l t R e s u l t Export Export Parameters Parameters E x c e p t i o n s E x c e p t i o n s IBM Global Business Services 2007 IBM Corporation 28 Jan-2007 Workflow Basic Training Dialog / or background : Execution of the method is via a work item in a users integrated inbox or in background by the workflow runtime system. Background methods cannot use messages or exceptions because they cannot be processed by the background system and will result in termination of the program. Synchronous / Asynchronous Synchronous methods finish executing before handing control back to the calling program. These types of methods can return export parameters, results and exceptions. Asynchronous methods do not return control to the calling program immediately. Once executed, they depend upon events to communicate the results of the method back to the calling program. Asynchronous object methods cannot have results, export parameters or exceptions. Methods - Call attributes IBM Global Business Services 2007 IBM Corporation 29 Jan-2007 Workflow Basic Training Result: Synchronous methods may return an export parameter as a result. A result can be defined like a dictionary field or an object type . Instance independence: Indicates whether an object reference is passed to the method by binding at the time of execution. Methods that generate and return an object reference, such as Create, or methods that generate a report listing should be instance independent. Methods - Call attributes IBM Global Business Services 2007 IBM Corporation 30 Jan-2007 Workflow Basic Training Import /Export Parameters The method parameter container contains references to all import, export and result parameters which need to be exchanged back and forth between the calling program (single-step task) and the method. Binding is necessary between the single-step task and the method parameter container to accomplish the data transfer. Import parameters are those values which are necessary to execute the method. Import parameters are retrieved from the container CONTAINER using the macro instructions SWC_GET_ELEMENT (single-line) or SWC_GET_TABLE (multiline). Export parameter values are passed to the container CONTAINER using the macro instructions SWC_SET_ELEMENT (single-line) or SWC_SET_TABLE (multiline). The result parameter is passed to the CONTAINER element RESULT via the same macro instructions. IBM Global Business Services 2007 IBM Corporation 31 Jan-2007 Workflow Basic Training Exceptions Error handling is accomplished through the use of method exceptions (synchronous methods only). The workflow definition can branch according to these possible error states and allow for subsequent steps to handle these conditions. Messages and exceptions cannot be used with background methods because they will terminate the program. Number of the exception: 0001-1000: exceptions defined for interfaces 1001-7999: application-specific exceptions (free for SAP development) 8000-8999: exceptions raised by the object manager 9000-9999: exceptions defined by the customer (free for customers) IBM Global Business Services 2007 IBM Corporation 32 Jan-2007 Workflow Basic Training Exceptions are implemented within a method, between the macro instructions BEGIN_METHOD and END_METHOD. EXIT_RETURN Code Variable1 Variable2 Variable3 Variable4. Code = the 4-digit number of the exception Variable1 through Variable4 correspond to up to 4 variables which can be derived from the message issued with the exception. The following exceptions (for temporary errors) are also available to allow exiting of the program: EXIT_OBJECT_NOT_FOUND = object not found EXIT_CANCELLED = cancelled by the user Exceptions IBM Global Business Services 2007 IBM Corporation 33 Jan-2007 Workflow Basic Training Events describe the change in the status of an object. Workflow are usually started using events Events IBM Global Business Services 2007 IBM Corporation 34 Jan-2007 Workflow Basic Training Object Type - Release Status Not accessible at runtime. Only in test or internal use, possibly unstable. Released for use by the customer. The functionality has been replaced. The old functionality is still supported for two releases. IBM Global Business Services 2007 IBM Corporation 35 Jan-2007 Workflow Basic Training Subtype The subtype inherits all attributes, methods and events of the supertype and is open for new customer-specific attributes, methods and events. The key fields of the supertype and subtype must be identical. This means that any methods and attributes defined on the parent can be executed and accessed on the child object. IBM Global Business Services 2007 IBM Corporation 36 Jan-2007 Workflow Basic Training Delegation This delegation is powerful because it lets you implement your own business logic without modifying any SAP code. As long as the objects are properly delegated, your method will be executed. Calling Calling Program Program KNA1 KNA1 Method: Method: Change password Change password ZKNA1 ZKNA1 Method: Method: Change password Change password Transaction: Menu Path: SW01 Tools Business Workflow - Development - Definition tools - Business Object Builder - Settings - Delegate IBM Global Business Services 2007 IBM Corporation 37 Jan-2007 Workflow Basic Training Objects in the workflow IBM Global Business Services 2007 IBM Corporation 38 Jan-2007 Workflow Basic Training Some common Business Objects and Interfaces BKPF Posting document BUS2019 Customer document BUS2020 Vendor document BUS2041 Asset document BUS2069 G/L account document BUS2029 Price change EKKO Purchasing document VBAK Sales document DRAW Drawing Object BUS2032 Sales order BUS1001 Material Master BUS1010 Customer Credit Account BUS1022 Fixed Asset Object BUS1065 Employee BUS2012 Purchase Order BUS2078 QA Notifications IFSTATUS Generate events from status management IFARCH21 Archive Link Interface IFIDOCOUT IDoc outbound processing IBM Global Business Services Workflow Basic Training Jan-2007 2007 IBM Corporation SAP Business Workflow - Basic Business Object Programming IBM Global Business Services 2007 IBM Corporation 40 Jan-2007 Workflow Basic Training Business Objects Programming Key Features BOR programming makes extensive use of macros. The macro instructions required for programming are incorporated via the include <object>. Attribute programming Database Field Indicator that the attribute value is determined directly from the content of a database field Code gets automatically generate Virtual Field Requires Implementation in the program of object type ex :- GET_PROPERTY Total CHANGING CONTAINER. DATA : Price TYPE Zprice, Qty TYPE Zqty. IF object-total is initial. SWC_GET_PROPERTY self Price Price. SWC_GET_PROPERTY self Quantity Qty. Object-Total = Price * Qty. ENDIF. SWC_SET_ELEMENT CONTAINER Total object-total. END_PROPERTY. IBM Global Business Services 2007 IBM Corporation 41 Jan-2007 Workflow Basic Training Business Objects Programming cont For multiline attribute the structure will look like GET_PROPERTY <AttributeID> CHANGING CONTAINER. code SWC_SET_TABLE CONTAINER <AttributeID> InternalTable END_PROPERTY. Methods Programming BEGIN_METHOD <MethodID> CHANGING CONTAINER. ..code END_METHOD. Ex : BEGIN_METHOD display CHANGING CONTAINER. SET PARAMETER ID MAT FIELD object-key-material. CALL TRANSACTION MM03 AND SKIP FIRST SCREEN. END_METHOD. IBM Global Business Services 2007 IBM Corporation 42 Jan-2007 Workflow Basic Training BEGIN_METHOD GETLIST CHANGING CONTAINER. DATA: CUSTOMERNUMBER LIKE BAPI1007-CUSTOMER, SALESORGANIZATION LIKE BAPIORDERS-SALES_ORG, ------ ------ RETURN LIKE BAPIRETURN, SALESORDERS LIKE BAPIORDERS OCCURS 0. SWC_GET_ELEMENT CONTAINER 'CustomerNumber' CUSTOMERNUMBER. SWC_GET_ELEMENT CONTAINER 'SalesOrganization' SALESORGANIZATION. ------ ------. SWC_GET_TABLE CONTAINER 'SalesOrders' SALESORDERS. CALL FUNCTION 'BAPI_SALESORDER_GETLIST' EXPORTING CUSTOMER_NUMBER = CUSTOMERNUMBER SALES_ORGANIZATION = SALESORGANIZATION ------ ------. IMPORTING RETURN = RETURN TABLES SALES_ORDERS = SALESORDERS EXCEPTIONS OTHERS = 01. CASE SY-SUBRC. WHEN 0. " OK WHEN OTHERS. " to be implemented ENDCASE. SWC_SET_ELEMENT CONTAINER 'Return' RETURN. SWC_SET_TABLE CONTAINER 'SalesOrders' SALESORDERS. END_METHOD. Writing/Reading Container Elements Defined as Field Values IBM Global Business Services 2007 IBM Corporation 43 Jan-2007 Workflow Basic Training Business Objects Programming cont An object reference can be created in method using SWC_CREATE_OBJECT macro BEGIN_METHOD <MethodID> CHANGING CONTAINER. ..code data : user type swc_object. SWC_CREATE_OBJECT user User <user id>. SWC_GET_PROPERTY user Name <name field>. code END_METHOD. IBM Global Business Services 2007 IBM Corporation 44 Jan-2007 Workflow Basic Training Business Objects Programming cont Exception is methods can be raised using the macro EXIT_RETURN EXIT_RETURN <Exception #> <Var1> <Var2> <Var3> <Var4> Where <Exception #> is the exception number defined for method Macros for Method Exceptions EXIT_RETURN <Exception #> <Var1> <Var2> <Var3> <Var4> Returns the exception IBM Global Business Services 2007 IBM Corporation Workflow Basic Training Container Marcos Definition and Initialization SWC_CONTAINER <Cont> SWC_CONTAINER_CREATE <Cont> IBM Global Business Services Workflow Basic Training Jan-2007 2007 IBM Corporation SAP Business Workflow - Basic Task and Workflow Template IBM Global Business Services 2007 IBM Corporation 47 Jan-2007 Workflow Basic Training Single and Multistep Tasks Tasks Tasks Single step Single step Multistep Multistep References References one object type one object type method method and displays one step and displays one step in the business process in the business process Represents the Represents the business business process process and is a sequence of and is a sequence of individual tasks and control individual tasks and control steps steps Transaction : PFTC Transaction : PFTC Menu Path Menu Path - -> Tools > Tools - -> Business Workflow > Business Workflow - -> Development > Development - -> Definition tools > Definition tools - ->Tasks >Tasks IBM Global Business Services 2007 IBM Corporation 48 Jan-2007 Workflow Basic Training Single-step tasks Single-step tasks describe elementary business activities. Single-step tasks operate on an object and refer to one object method each Single-step tasks are linked to their possible and permitted agents whose organizational assignments are described in the organizational plan of the enterprise. Executable single-step tasks are represented by work items at runtime. IBM Global Business Services 2007 IBM Corporation 49 Jan-2007 Workflow Basic Training Workflow definition - Multistep tasks A workflow definition has a modular structure consisting of individual steps which are linked together. The multistep tasks form the business framework for a workflow definition and each references one workflow definition. A step in a workflow definition can be an activity. An activity always refers to one task (= single-step task or multistep task). An activity with one simple triangle refers to a task. An activity with three triangles refers to a workflow (subworkflow). IBM Global Business Services 2007 IBM Corporation 50 Jan-2007 Workflow Basic Training Task Definition Synchronous and Asynchronous Methods IBM Global Business Services 2007 IBM Corporation 51 Jan-2007 Workflow Basic Training Defining a Task IBM Global Business Services 2007 IBM Corporation 52 Jan-2007 Workflow Basic Training Settings for Tasks Background Confirm end of processing SAPphones Task executed in background depending on object method At runtime user can create attachments User explains explicitly that work item is no longer is to be processed The workflow dials the telephone number attached to the current customer IBM Global Business Services 2007 IBM Corporation 53 Jan-2007 Workflow Basic Training Workitem Text Title of workitem in the Business Workplace First create the workitem text and position the cursor to include a varible Choose the 'Insert variable' icon under the workitem text Processes request from &_WI_Object_ID.CreatedBy& Example IBM Global Business Services Workflow Basic Training Jan-2007 2007 IBM Corporation SAP Business Workflow - Basic Workflow Steps IBM Global Business Services 2007 IBM Corporation 55 Jan-2007 Workflow Basic Training Workflow definition steps Workflow definition is made up of individual steps. When creating a step in a workflow definition, the step type must be specified first. There are 1. Steps which refer to business activities (activities & user decision) 2. Steps which are used for internal process control and monitoring (condition, multiple condition, loop, etc) IBM Global Business Services 2007 IBM Corporation 56 Jan-2007 Workflow Basic Training Business Activities Steps Activity Can be a single step task with basic business functionality Can be a multi-step task, which reference to a workflow definition User Decision This provides an opportunity for user interaction with the system. The response to this decides the selection of the subsequent step. Subworkflow An activity which refers to a workflow rather than a task IBM Global Business Services 2007 IBM Corporation 57 Jan-2007 Workflow Basic Training Condition Branch on the basis of control information from the runtime dependent context of the workflow. An attribute of this object can also be accessed for condition evaluation Condition evaluation can be done by Field comparison e.g constants , object attribute, system fields Multiple condition In contrast to condition, multiple condition makes it possible for the workflow definition to branch in more than two branches. For evaluation of the multiple condition, the value of the basis of comparison is checked at runtime against the comparison values and branched accordingly. Internal process control Steps IBM Global Business Services 2007 IBM Corporation 58 Jan-2007 Workflow Basic Training Internal process control (contd.) Until Loop Steps are processed repeatedly until the condition contained in the UNTIL step is true. Fork Used for parallel processing branches. Only a part of the parallel processing branches actually has to run to continue the workflow. Dynamic parallel processing is also possible IBM Global Business Services 2007 IBM Corporation 59 Jan-2007 Workflow Basic Training Internal process control (contd.) Send mail Text entered in this step can be used to send a mail to the agent assigned Container operations Used to perform arithmetic operation of value assignment to workflow container elements using constants and data in the workflow container . IBM Global Business Services 2007 IBM Corporation 60 Jan-2007 Workflow Basic Training Internal process control (contd.) Event Creator An event is created when this step in the workflow is reached. Other workflows can be started as a reaction to the event created in this step. This event must be the triggering event of the relevant workflow tasks and/or templates. WAIT for event Used to stop the whole execution of the workflow until the event is created in the system. Used to wait for events for parallel processing IBM Global Business Services Workflow Basic Training Jan-2007 2007 IBM Corporation SAP Business Workflow - Basic Containers and Bindings IBM Global Business Services 2007 IBM Corporation Workflow Basic Training Types of Containers IBM Global Business Services 2007 IBM Corporation 63 Jan-2007 Workflow Basic Training Workflow Container The workflow container contains workflow-specific system variables and other elements which are defined explicitly. As part of the definition of the workflow task, the import and export parameters of the workflow are defined as elements of the workflow container. When the workflow is defined in the workflow editor, elements can also be added to the workflow container. These elements are then "local variables" within a workflow definition and can be used, for example, to set up a counting loop. IBM Global Business Services 2007 IBM Corporation 64 Jan-2007 Workflow Basic Training Task Container Each task container already contains the workflow system variable and any additional elements for the method parameters of the referenced object method. You have to add additional elements to the task container for additional values are required for variable replacement in the work item text or in the long texts IBM Global Business Services 2007 IBM Corporation 65 Jan-2007 Workflow Basic Training Other Types of Containers Event parameter container Contains an element which can take the (object) reference to the object whose change of status is announced via the event. Rule parameter container Contains the elements required as input in connection with the rule resolution to be run at runtime. Method parameter container Contains elements which will be required as import and export parameters in connection with the method execution. IBM Global Business Services 2007 IBM Corporation 66 Jan-2007 Workflow Basic Training Binding A binding is simply the art of of pouring selected container elements from one container into another. The binding editor is available when defining: Workflow definitions Triggering events Workflow steps Workflow steps ( Standard roles/ Object methods with parameters) The binding editor always references the container to receive the application data. Binding definitions can reference: Constants Variables (container elements) System fields IBM Global Business Services 2007 IBM Corporation Workflow Basic Training Container & Dataflow Task Task Container Container Method Method Container Container Event Event Container Container Workflow Workflow Container Container triggering triggering event event sync sync task task sync sync method method sync sync task task sync sync method method role role async async task task async async method method 4 4 terminating terminating event event 1 1 2 2 3 3 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 Role Role Container Container IBM Global Business Services Workflow Basic Training Jan-2007 2007 IBM Corporation SAP Business Workflow - Basic Events IBM Global Business Services 2007 IBM Corporation 69 Jan-2007 Workflow Basic Training An event describes a possible status change for an object in the SAP System. Before an event can be used in a workflow, it must be defined in the Business Object Repository for the object type. Events must be triggered explicitly. The application itself can be the triggering agent. Event IBM Global Business Services 2007 IBM Corporation Workflow Basic Training Types of Event Creation Change Change Document Document Status Status Management Management Message Message Control Control Specific Specific HR Tables HR Tables ABAP Code ABAP Code In User Exit In User Exit IBM Global Business Services 2007 IBM Corporation 71 Jan-2007 Workflow Basic Training Using Customizing for event trigger Menu Path :Basic menu Menu Path :Basic menu - -> Tools > Tools - -> Business Workflow > Business Workflow - -> Development > Development - -> Definition tools > Definition tools - -> Events > Events IBM Global Business Services 2007 IBM Corporation 72 Jan-2007 Workflow Basic Training 1. Event Creation of Change Document Changing Changing Master data Master data Event linkage is Event linkage is done to connect to done to connect to the workflow/ task the workflow/ task Event creation Event creation (SWEC) (SWEC) Change logged Change logged using using change documents change documents IBM Global Business Services 2007 IBM Corporation 73 Jan-2007 Workflow Basic Training 2. Using ABAP Code This is using done by writing custom code e.g. by using SAP FM like SWE_EVENT_CREATE inside user exits, BADI etc. UALL IUNU1I0N '5WL_LvLN1_UPLA1L' LXP0P1INU 0J1YPL - 0J1YPL 0JKLY - 0JKLY LvLN1 - LvLN1 UPLA10P - APPLIUAN1 51AP1_WI1P_0LLAY - ' ' IMP0P1INU LvLN1_I0 - LvLN1I0 1ALL5 LvLN1_U0N1AINLP - U0N1AINLP LXULP1I0N5 0J1YPL_N01_I0UN0 - 01. II 5Y-5UPU - 0. U0MMI1 W0PK. LN0II. UALL IUNU1I0N '5WL_LvLN1_UPLA1L' LXP0P1INU 0J1YPL - 0J1YPL 0JKLY - 0JKLY LvLN1 - LvLN1 UPLA10P - APPLIUAN1 51AP1_WI1P_0LLAY - ' ' IMP0P1INU LvLN1_I0 - LvLN1I0 1ALL5 LvLN1_U0N1AINLP - U0N1AINLP LXULP1I0N5 0J1YPL_N01_I0UN0 - 01. II 5Y-5UPU - 0. U0MMI1 W0PK. LN0II. IBM Global Business Services 2007 IBM Corporation Workflow Basic Training Event Creators, Receivers and Event Linkage Published Events Receivers Event Event Linkage Linkage Creator Anybody want this event? IBM Global Business Services 2007 IBM Corporation Workflow Basic Training Type Linkage Entry Transaction: Transaction: SWE2 SWE2 Menu Path :Basic menu Menu Path :Basic menu - -> Tools > Tools - -> Business Workflow > Business Workflow - -> > Utilities > Other tools >Event linkage Utilities > Other tools >Event linkage IBM Global Business Services Workflow Basic Training Jan-2007 2007 IBM Corporation SAP Business Workflow - Basic Agent Assignment and Role Resolution IBM Global Business Services 2007 IBM Corporation 77 Jan-2007 Workflow Basic Training Agent Agent is an executor of a work item. Agent is responsible for executing a task in a workflow. Agent is determined by the system either through organizational chart or directly if user is assigned as agent for a particular task. If the agents of the individual workflow steps are determined using the customer-specific organizational chart, your agent assignment in the workflow remains flexible to change. IBM Global Business Services 2007 IBM Corporation 78 Jan-2007 Workflow Basic Training Types of Agents Deadline Agents Deadline Agents Notification Agents Notification Agents Processing Agents Processing Agents Selected agents Selected agents are those possible are those possible agents who are agents who are elected to execute a elected to execute a task at runtime task at runtime Possible agents Possible agents are a collection of are a collection of agents who qualify agents who qualify to execute a work to execute a work item item Actual agent Actual agent is the is the agent among those agent among those selected agents who selected agents who actually processes the actually processes the work item work item IBM Global Business Services 2007 IBM Corporation Workflow Basic Training Tasks: Possible Agents & Default Roles User User Position Position Job Job Org. Unit Org. Unit Person Person TASK TASK Default role Default role Possible agents Possible agents Business Business Workplace Workplace The workplace displays the work items for a agent IBM Global Business Services 2007 IBM Corporation Workflow Basic Training How are Selected Agents Determined With and Without a Default Role? Possible Agents Task definition with no default role Task definition with default role Triggering Triggering Event Event IBM Global Business Services 2007 IBM Corporation Workflow Basic Training How are Selected Agents Determined With a WF Agent? All possible agents who qualify to execute task Step definition at workflow defn. level with an agent specified. This overrides default role at task defn. level Task definition with no default role Task definition with default role Triggering Triggering Event Event IBM Global Business Services 2007 IBM Corporation 82 Jan-2007 Workflow Basic Training Rule Basics Transaction : PFAC_INS(Create) Transaction : PFAC_INS(Create) Menu Path: Menu Path: Tools Tools Business Workflow Business Workflow Development Development Definition tools Definition tools Rules for Agent Rules for Agent Assignment Assignment Create/Change/Display. Create/Change/Display. Each rule gets a 8 digit generated by the system prefixed with AC Rules can be tested using PFTC or by function module RH_GET_ACTORS IBM Global Business Services 2007 IBM Corporation 83 Jan-2007 Workflow Basic Training Rule Definition in a Activity Step Type Various options to create standard rules : 1. Responsibility (Pure configuration no ABAP coding) Defined Value ranges are assigned to Agents Data is filled from workflow container at runtime 2. Evalution paths (Pure configuration no ABAP coding) 3. Organizational data (Pure configuration no ABAP coding) Jobs , positions 4. Functions to be executed ABAP Code Function Module IBM Global Business Services 2007 IBM Corporation 84 Jan-2007 Workflow Basic Training 1. Rule Definition with Responsibility: Example Jones Jones Smith Smith Anna Anna Michael Michael William William Ross Ross David David George George Peter Peter Employee Names A Employee Names A- -K K Employee Names L Employee Names L- -Z Z Mr. Miller Mr. Miller Position : Administrator Position : Administrator HR HR Mr. Andrew Mr. Andrew Position : Administrator Position : Administrator HR HR IBM Global Business Services 2007 IBM Corporation 85 Jan-2007 Workflow Basic Training Rule Definition with Responsibility: Example Name Name Uname Uname Element Element Name Name Data Type Data Type Container Element Container Element Employees from L-Z Z* L* Employees from A-Z K* A* Name From To Value From Rules Container Definition Rules Container Definition Areas of Responsibility Areas of Responsibility Mr. Andrew Mr. Andrew Mr. Miller Mr. Miller Which Value? Which Value? Which Agent Which Agent IBM Global Business Services 2007 IBM Corporation Workflow Basic Training 2. Role Resolution with Function Modules Exception indication no agents found Exception indication no agents found NOBODY_FOUND NOBODY_FOUND Exception Exception Outgoing list of agents in agent format Outgoing list of agents in agent format SWHACTOR SWHACTOR ACTOR_TAB ACTOR_TAB Table Table Incoming rule container Incoming rule container SWCONT SWCONT AC_CONTAINER AC_CONTAINER Table Table Meaning Meaning Data Type Ref Data Type Ref Name Name Parameter Parameter Type Type Role resolution with function module should be done only for complex criteria Here are the basic steps: 1. A function module with the following interface is created 2. Create a rule setting the type Function to be executed. 3. Enter the created function module name 4. Create container elements. IBM Global Business Services Workflow Basic Training Jan-2007 2007 IBM Corporation SAP Business Workflow - Basic Organization structure IBM Global Business Services 2007 IBM Corporation 88 Jan-2007 Workflow Basic Training Organizational Structure Business Scenario An organizational plan in SAP describes the organizational structure of a company. The workflow system finds the agents of the individual tasks by evaluating the organizational plan The functions to create and maintain organizational plans are part of the Personnel Planning and Development (PD) part of the SAP HR module You must connect this organizational structure to the workflow IBM Global Business Services 2007 IBM Corporation 89 Jan-2007 Workflow Basic Training Organizational units contain positions, occupied by employees. Jobs are abstract descriptions of task assignments. Positions can be linked to jobs. They inherit all the tasks assigned to that job. Users. A user is an SAP logon user ID. It thus represents a single person. Persons. A person is a specific employee created in the HR module. Workflow tasks can be assigned to organizational units, positions, jobs or users. The workflow system uses organizational structure to route work items to the correct recipients Organizational Management IBM Global Business Services 2007 IBM Corporation 90 Jan-2007 Workflow Basic Training Create Organisational Plan Create root organizational unit Create root organizational unit Create root organizational unit Additional organizational units Additional organizational units Additional organizational units Create jobs Create jobs Create jobs Create positions Create positions Create positions Assign Holders Assign Holders Assign Holders Assign tasks Assign tasks Assign tasks Transaction: Menu Path: PPOCW Transaction: Menu Path: PPOCW Tools Tools Business Workflow Business Workflow - - Development Development - - Environment Environment - - Organizational Management Organizational Management - - Simple Maintenance Simple Maintenance Org plan basic data Org plan basic data - - Create Create Create Executive Board Create Executive Board Create Executive Board Create Sales region , Production Create Sales region , Production Create Sales region , Production Administrator , Sales Manager Administrator , Sales Manager Administrator , Sales Manager Sales Manager eastern Zone Sales Manager Sales Manager eastern Zone eastern Zone Create Sales Order Create Sales Order Create Sales Order IBM Global Business Services 2007 IBM Corporation 91 Jan-2007 Workflow Basic Training Transaction - PPOCW IBM Global Business Services Workflow Basic Training Jan-2007 2007 IBM Corporation Workflow Monitoring IBM Global Business Services 2007 IBM Corporation 93 Jan-2007 Workflow Basic Training Event Trace- SWEL IBM Global Business Services 2007 IBM Corporation 94 Jan-2007 Workflow Basic Training Event Trace - SWELS The Event trace needs to be switched on for the event to be visible in the trace IBM Global Business Services 2007 IBM Corporation 95 Jan-2007 Workflow Basic Training Event Log Details Event linkage/instance Linkage not active. Full key of the business object is not available to create the instance The event had a start condition defined and the same was not met. The evaluation of the check FM condition resulted to FALSE The event started a workflow/task successfully. IBM Global Business Services 2007 IBM Corporation 96 Jan-2007 Workflow Basic Training Workflow log-SWI2_FREQ IBM Global Business Services 2007 IBM Corporation 97 Jan-2007 Workflow Basic Training SWI2_FREQ Contd. The agents who have participated in the workflow is displayed here. For all the background steps agents is WF-BATCH The screen displays the status of individual Workflow instance for the selected workflow IBM Global Business Services 2007 IBM Corporation 98 Jan-2007 Workflow Basic Training Workflow log-SWI2_FREQ Normal View On clicking this the selected/possible and excluded agents can be viewed if the dialog step is in READY status. If status in COMPLETED then the selected agents is no longer available. This displays the technical view of the workflow log This icon indicated a workflow parent and subsequent sub- workflows This displays the graphical view of the workflow log IBM Global Business Services 2007 IBM Corporation 99 Jan-2007 Workflow Basic Training Agents involved in Workflow The agents who have participated in the workflow is displayed here. For all the background steps agents is WF-BATCH IBM Global Business Services 2007 IBM Corporation 100 Jan-2007 Workflow Basic Training Workflow log-SWI2_FREQ Graphical View The green line indicated in which step the workflow is currently lying IBM Global Business Services 2007 IBM Corporation 101 Jan-2007 Workflow Basic Training Workflow log-SWI2_FREQ- Technical View The value for each container (WF or task) is populated can be viewed This displays the status of workflow or task. A complete blue cube denotes Complete status. A partial blue cube denotes that the task is In Process status. A completely white cube denotes a task in Ready status. A partially red cube denotes a task in Error. IBM Global Business Services 2007 IBM Corporation 102 Jan-2007 Workflow Basic Training Some Important Jobs SWWDHEX For deadline monitoring SWWERRE For error Monitoring SWEQSRV For Event Queue Delivery IBM Global Business Services 2007 IBM Corporation 103 Jan-2007 Workflow Basic Training Workflow Explorer - SWDM IBM Global Business Services Workflow Basic Training Jan-2007 2007 IBM Corporation Workflow QUIZ IBM Global Business Services 2007 IBM Corporation 105 Jan-2007 Workflow Basic Training QUIZ SAP workflow can be used (i) When work process have to be run repeatedly (ii) Process involve several people or departments (iii) Process include a range of activities (iv) All of the above SAP Workflow allows process owners (i) To keep an eye on deadlines (ii) Provides statistics on the length of time to complete work processes (iii) Determine the workload with regard to individual participants (iv) All of the above (v) All of the above except (iii) What do you understand by the term agents in SAP workflow. Agent assignment in SAP workflow can be done using (i) Organization structure (ii) Single users (iii) Security Roles (iv) All of the above IBM Global Business Services 2007 IBM Corporation 106 Jan-2007 Workflow Basic Training QUIZ Workflow builder is used for building (i) Workflow template (ii) Business object (iii) Organization structure (iv) Task SAP Workflow is triggered by (i) Events (ii) Business Object (iii) Task (iv) Method What do you understand by workitem State difference between workitem and notification SAP Workflow can handle escalation - True/false IBM Global Business Services 2007 IBM Corporation 107 Jan-2007 Workflow Basic Training QUIZ SAP Workflow uses the existing transactions and functions of the SAP System to form new business processes True/False A background step in a workflow needs agent assignment True/false Workflow step which is executed automatically by the system is known as (i) A background step (ii) An dialog step (iii) A internal control step (iv) None of the above Business Workflow provides a number of tools for (i) Defining Workflow (ii) Analyzing workflows (iii) Monitoring and reporting workflow (iv) All of the above SAP provides several workflows that map predefined business processes which can be used with simple configuration - True/False IBM Global Business Services 2007 IBM Corporation 108 Jan-2007 Workflow Basic Training QUIZ Which transaction code displays the sap business workflow menu? a) SWDD b) SWUD c) SWLD d) SWED What is the transaction to make basic workflow customizing configurations in a system? a) SWU5 b) SWU6 c) SWUD d) SWU3 When we make a subtype of a standard sap business object which of the following cannot be modified in the custom object. a) Interfaces b) Key fields c) Attributes d) Events Which of the following elements does the interface IFSAP not provide across all business object types. Method ExistenceCheck b) Attribute ObjectType c) Event Created d) Method display Which of the following parameters is not mandatory when we create an event using the function module swe_event_create? a) Object key b) Object type c) Event name d) Event parameter(s) IBM Global Business Services 2007 IBM Corporation 109 Jan-2007 Workflow Basic Training QUIZ To create a start condition for an event based on a parameter A, A must be? a) A key field of the business object for the event b) Event parameter for that specific event c) Any field in the lead table for the business object type d) An attribute of the business object. 8) Which transaction is used to check event type linkages? a) SWEL b) SWED c) SWI2 d) SWE2 9) Which of the following objects cannot have a instance linkage with an event? a) workflow template b) standard task c) wait for event step d) create event step 10) Which is the very first step to build a parent workflow template? a) Attach a triggering event b) Create object type container c) Create the workflow definition in the builder d) Assign a workitem text to the template. IBM Global Business Services 2007 IBM Corporation 110 Jan-2007 Workflow Basic Training QUIZ Which of the following workflow steps may be simulated to a CASE ENDCASE statement in ABAP programming. User decision b) Condition c) Multiple condition d) Fork While checking the event trace if we get an entry with a red icon then this signifies? The event has not been triggered b) the event type linkage is missing c) the event has raised an exception d) the workflow has gone into error In the workflow log which of the following information is not available? Individual task statuses b) the event had a start condition or not c) the user who triggered the workflow d) the task container values at runtime When we use rule resolution to determine agents, the rule container receives its data from? workflow container b) task container c) method parameters d) event container In which of the following workflow step we cannot check a condition to determine the process flow. a) Loop until b) Fork c) Wait for event IBM Global Business Services 2007 IBM Corporation 111 Jan-2007 Workflow Basic Training QUIZ Why do we need an event linkage? How are exceptions raised in a business object program for a method? How are the import parameters accessed in a program. When should rules using responsibility be used. State difference between single and multi task. Give a example when each can be used What do you understand by subworkflow . State the steps of creating a subworkflow. What is the transaction for customizing? What is the different between possible agent, selected agent and actual agent? What it _EVT_OBJECT IBM Global Business Services 2007 IBM Corporation 112 Jan-2007 Workflow Basic Training QUIZ In a particular workflow scenario suppose that I have 5 agents A, B, C, D & E. Agents A, B & C are defined as possible agents for a dialog task (through agent assignment in the task), agents A, C, D & E are determined through the default rule specified in the task definition and agent E is specified as an excluded agent in the step definition of the dialog task in the workflow template. Then which of the following is false. Agents C & D can be selected agents for the step Agent A can be a selected agent for the step Agent E is a possible agent but cannot be the selected agent for the task Agent B can be a selected agent for the step Which of the following macros will not work in an asynchronous method. swc_get_property self swc_get_element container swc_set_element container swc_create_object IBM Global Business Services 2007 IBM Corporation 113 Workflow Basic Training Thank you Questions? Questions? Comments? Comments? Suggestions? Suggestions? Within Enterprise External Business Partners