Abap Workflow

March 17, 2018 | Author: Anandakrishnan Sundaresan | Category: Business Process, Workflow, Object (Computer Science), Data Type, Computing


Comments



Description

ABAP WORKFLOWContents:  Introduction to Workflow  Object Types And Delegation of Objects  Creating Custom Tasks and Event  Creating Workflow.  Integrating Custom task, SAP defined activities in Workflow.  Important T Codes  Conclusion ABAP WORKFLOW :- Workflows have 2 main purposes:To streamline a business process to make it faster. To ensure that a business process is executed correctly. A workflow formally defines and implements a business Process. Real Time scenarios for Workflow Uses:A workflow management system facilitates the electronic processing of structured processes that : Include a number of activities Always occur in a similar or identical form Involve several people or departments, and Require a high degree of coordination Workflow management systems control processes according to a predefined model and are particularly suitable for structured organizations Workflow related Topics to be known:Object Type Object Subtype, Attributes, Methods, Events for Objects, Delegation of Objects Creating Custom Tasks, Background Task Event Linkages with tasks and Workflow Difference between Task Container and Workflow Container Things to Remember :Workflow is not Standard e-mail and groupware (but workflow can work with these) Data distribution across several systems (but workflow supports this ALE and EDI option) Effectiveness of Workflow:For User Faster, Simpler access to information Administrative tasks are less demanding Processes are easier to learn and understand For Management Better control over Information Deadlines Service levels Process costs Flexibility in changing Processes Organizational structure Underlying technology For Enterprises (This document explains steps to create workflow in 4.0 and later versions) Pre Requisite steps:Step 1:Create table with required fields. .Increases production Backlog reduction Distribution of information and work Speeds up processes Cash discounts more often Better/faster reaction to errors Increases customer satisfaction Processes completed more quickly Better information flow Scenario:After Creating Purchase order. Step 2:Create a function module which will fetch data from EKKO (Purchase Document Number) table and update created table. a customized table should automatically get updated with required values. There are small modifications is ECC6.6 versions. Generic Overview of scenario:Creation of Purchase Order On Save . Reach out to pathBasis Components –>Business Management ->SAP Business Workflow –> Basic Settings->Maintain Prefix Number If the table does not have entry please create an entry with unique number not already used in the table.Step 3:Please check whether the client and server which you are working on have a Prefix Number Entry in tableT78NR.Event get fired (Purchase Order Created) Event triggers Workflow . Step 4:Create one Customizing Transport Request and one Workbench request using Transaction SE10. Now we are ready to create Workflow and Related Objects. To check these go to transaction SPRO. BUS2012 Check whether the object or interface type contents required event in current scenario it’s ‘Create’. . E.Workflow Executes steps . Creating Object Types:Go to Transaction SWO1 and search for Object or Interface Type Related to Purchase order.g.Tasks assigned to those steps. Tasks Execute functions or methods Function Module Executed Data is stored in Customized Table. As we can see there is no Event related to ‘Create’ Event. Go back to first screen and click on the Button . So now we need to define our own Object Type and Use it to complete task. Now in this Subtype we can add our own Interfaces. Methods and Events of Super Type. . Methods and events. Fill in all fields and then press enters which will create a new subtype of BUS2012 and will inherit all the Attributes. Attributes. Reference diagram from SAP AG explaining Relationship between ‘Super type’ and ‘Subtype’ Here I have added a new method named ‘FILL_DATA’ and an Event ‘Created’ for my Subtype. Point the Cursor on the place where you want to add new functionality.g. Methods Click on create button which will give you Popup window asking Press no and it will show another window . E. Now let us go to detail of how to create new methods or events or Attributes. .Fill in all required details and press enter. Synchronous: Instance independent: Switch to tab ABAP. Method Name Name and Description If you want users to execute this method select dialog or if you want it perform as a background task leave it blank. Select function module radio button and give name of function module you created before which will fetch data from EKKO and update in custom table. If you want to see program keep cursor on method created and press button You will see window like this. Note: This is old ABAP Editor. . There is no workaround for this to make it in normal editor as of now. So now we have to give Import parameter as Key of the Object Type which we have created. Press save and go back to object type window Now we will create Event ‘Created’ As while creating method keep cursor on ‘Events’ and click on create button which will lead to following window. It’s nothing but FM call. Now we are ready with out Object Type with Customized method and Event for our scenario. Now. Save object prompt will appear again.Fill in the required detail Now save Object with Workbench request in a development class. Save it and then click on ‘Generate Button’ This should give message in status bar If any error message then please check the code of method and do the Implement and Release steps again. After this Go to Object Type  and select first ‘To Implemented’ and then ‘To released’. Creating Task:- . keep cursor on created method and go to Select ‘To Implemented’ then select ‘To Released’ Repeat steps for Events. . And in the Object Method gave Object type as our created Object type and Method for which this task is implemented.Select Create Task from Sap Easy Menu Fill in the details and click on new button Here I have created task called ZT_WFTRN. Terminating event can be used to stop execution of the Event in certain conditions Now save the task and press Container button. This is the place where we Link Method with our Event.) Triggering Events and Termination Events: As names suggest these are the starting and ending conditions for out task. Use your Customization task and save it. This will activate the Event but before that it will ask you to save this event linkage. Don’t forget to Click on the . Basic Data I have already shown above. . Description is nothing but Documentation about the task Alternating methods: here we can define any alternating method than the given default method in Header data section (It might be useful when we want to use same task to work differently on different conditions.We can have different setting is all the tabs available in Task Creation. This means now every time when Event occur the method will be executed. Click on create button and create new container with Our Object type created for Workflow. One can choose the task to be as background task. Containers are nothing but the Variables in the Workflow that hold the values in the workflow. Before that let’s take a insight on ‘Container’. Save Task Again. Please change status of task to Released without fail before saving. Save it and come back. For this task since we will be calling this thro’ workflow we are keeping it black. So they are best treated as the variables. They can be simple variables or structures or even objects of any class. Also we can select other checkboxes which are Executable as form means which will run in foreground and If confirm end of processing is checked then it will ask for user input while ending task. You can also see a button on the taskbar with Here we can give default values for task to work if we don’t want to manually give it while execution of task. . Now we are ready with Task remaining part is Creation of workflow and linking this task to Workflow. is for running two tasks concurrently and then upon successful execution of both the tasks move forward for the next step. (Same as Linux FORK () and Child ()) .Creating A WORKFLOW Now we are ready with all the basic need to create our main Workflow. Double click on undefined task white arrow in workflow and pop up occurs. I have created ZWF_container for workflow. Just below navigation area we can see workflow container. Now go to workflow container and Double click to create new Container for Workflow same as we have created for Task with new name. At the right hand side bottom we can see all the types of Activities we can do. Left hand side of screen we can see explorer like navigation area which will list down all the steps in Workflow. So now we will go to T-Code SWDD. (Work Flow Builder) Click on new button and you will see screen like this… This is our workflow main station. Which list all the steps which we can select Activity – Giving customized created task as execution step for workflow Condition and Multiple Condition – Like IF ELSE statement and Case statement Fork. will trigger a mail to desired recipients.Send mail. Also in workflow we can have two Loop as we can see Loop (Until) and Loop (while) Now we will select Activity in our scenario which will show us this page. . Give created task in the format of TSXXXXXXXXX where xxx is your task number which we have created in the section above. After giving task press Button Binding. If it’s not a Background or Multiple tasks we can assign agents which will execute the task Agent can be Expression. Or Work center.This binding will bind the Task Container and Workflow container so that task gets executed with the values which are exported from Workflow. Since this is background task we don’t have to give any specific agents or users to execute this task. Organization Unit. Job. . Click on generate button. Role. User. After this go to Agent assignment where we can see button with apple on it. created (which will get triggered after creating any purchase order. So now we will see how to Link Events to workflow. Press ‘Activate’ button and also binding button just next to task. Before that go to And maintain entry for the Change Document related to Purchase Order i.After this please save the task by clicking right button which will again take you to the workflow main screen. (This is a Cross client table) (We can find Change document related to Purchase order searching in define workflow properties) We will have to go to Workflow header by pressing header button This will take us to screen Now here we are giving our own created Event which is ZT_WFTRN. Now we are almost ready about our workflow but still one most important thing is missing. EINKBELEG by clicking on new entry.e.e. Trigger to start this Workflow i. event by which this workflow will be called and which in turn execute the task. . Execution Whole purpose of this Scenario was to update a Customized table just after creating Purchase order. Here we can give some more conditions to be checked before executing workflow after event has occurred. So we will now create a purchase order and then check our customized table. Now we are ready with All the Required Objects ready and workflow ready. It’s nothing but a condition specification column. Save and Activate workflow.Here we can see one more column which I did not explain before now we will see what this is. Press Agent assignment button again here and then press generate. And then check table which has this purchase order . Come back to workflow. Additional Information and Tracking If some error has occurred and our table is not updated first thing we can check is whether the event was fired or now. We can see this using session SWEL (SAP WORKFLOW EVENT LOG) Give Event Name in Filter or Object name which we created and then execute which will give a report. Our First Workflow is complete. Double click on event and we will be on the screen .So that’s it. So we are sure that event was fired and data was properly given to the workflow so now we can check whether the problem was in workflow and task. We can see event did occur And in the receiver type the name was given as Workflow which we created. Also Green Square shows that event was successful. Click on List of technical details and check whether error occurred anywhere. If any error we can just click and check the error. In this case since it was successful execution nothing will be in Error.Business Workflow Explorer SWELS .Main Workflow Builder PFTC . SWDD .Click on work item and then click on Workflow Log. Event Type Linkages SWUS .The Business Workplace SWDM .Switch Event Trace On/Off SWETYPV . Conclusion So here we are ready with out first workflow. display.General task maintenance SWO1.Display/Maint. Most of the times errors are about the binding of the Task and Workflow So please check all the steps are executed properly Task binding Agent assignment Event Binding Event agent assignment Data type of all the containers should be same. We can add any number of tasks in this workflow. Also we can trigger same workflow from different events such as changed. Useful Transaction Codes Area Code SWLD lists all transactions associated with Business Workflow.Business Object Builder SBWP.Test Workflow . Workflow for Objects SW14 .Change PFTC_DIS .Create Workflow SWLV .Workflow Builder .Start Workflow SWI6 .Message Control AWUW .Work Items by Processing Duration Task analysis SWI11 .Maintain Views TASK/TASK GROUPS PFTC_INS .Work Items with Monitored Deadlines SWI2_DURA .SWUI .Task profile Function modules used in Workflow: .Workflow Start Conditions Work item analysis SWI2_FREQ .Workflows for Objects Types SWDB .Copy PFTC_DEL – Delete T-codes Related To Events Events Creation BSVW .Logistics Information System (LIS) Event Linkages SWB_COND .Create PFTC_CHG .Work Items per Task SWI2_DEAD .Tasks in Workflows SWI13 .Display PFTC_COP .Status management NACE . it will call the Tasks associated with each step types in the workflow. Basically Workflow provides answers to questions like what to do (Object).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 work item using events SWW_WI_REJECT ”reject work item SWW_WI_EVENT_RECEIVE “retrieve event for a workflow SWW_WI_DISABLE “lock work item against execution SWW_WI_ENABLE “remove lock against execution of work item. 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. Let’s answer some basic queries related to SAP business workflow. Then the Task intern may call Methods defined in the Object and the Rule Container to determine the Agents Dynamically. Workflow ensures that the right work is sent to the right person at the right time in the right sequence with the right information. when to do (Event). Let’s put it in a simple way Event --> Workflow --> Task --> Method --> Rule What are the different layers in Workflow Engine? . Few questions rose in my mind too when I was going through the workflow training. What is Workflow? Workflow is a tool provided by SAP to automate the complex business processes. How Workflow can be Started/Triggered? Workflow is triggered by an event. to what (Task). who has to do (Agent) and in what order (Workflow Definition) the work has to be done. Once the workflow gets started.  How Process. We can customize the Business Workflow as per our need and can add up to six dynamic columns through the transaction SWL1. We can perform various functions in the workplace such as updating the work list. Material etc. reserve or replace the work item and many more. i. Business Logic and People are linked in Workflows? The business processes are defined in Workflow builder. It is the place where we receive the Work items. Business Process: Business processes are defined in Workflow builder. It’s just like our regular mailbox but with some additional features. Each activity consists of a single step task. display workflow log. methods and . Customer. Notifications.  Methods and Events for a particular business entity. which can be a standard task or a workflow template. There are 3 layers in the Architecture of Workflow Engine: Business Object: Business object (BO) is basically collection of Attributes.e. which can be a standard task or a workflow template. ABAP code will be in Business Object. Rules and the Tasks are used to map these elements to the different agents. Each activity consists of a single step task. Associated Business Logic is built in Business Objects. execute the work item. Each and every  small work process is called as an activity in the workflow builder.  Each and every small work process is called as an activity in the workflow builder. Documents etc. Business Objects consist of attributes. What is Business Work Place? Business Workplace is the interface between the user and the workflow system. Example of BO: Sale Order. once a particular workflow is executed. Position (S) and Person (P). Organization Model: Organization model mainly has four important elements: Org unit (O). We can maintain substitution (assigning your work to other agents) in two ways: Personal substitute (for an SAP user) and Position substitute. Vendor. Job (C). or selection report can be executed by its possible agents (not only by its actual agents). Actual Agent should be a subset of Possible Agents minus the Excluded Agents. 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. workflow log. Rules to Determine Agents? The possible rules to determine agents are: . People / Group of people responsible for taking actions are defined in organization structure. events. The possible agents of a multistep task are those employees in the company who are authorized to start the respective task in dialog. Person responsible for taking an action is called actual agent. 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.  ·  Who is an Agent? An agent is a person or a group of persons who can take an action during workflow runtime. Excluded Agents: Persons who are excluded from taking action on a task. A work item which is displayed via the workflow outbox. Action can be approval of some business document. A single-step task cannot be processed as a work item if there are no possible agents. Methods consist of ABAP code. These are assigned in the workflow definition at the workflow activity. It is defined in the workflow activity. creation of some document or sending email. The possible agents always form the set from which the selected agents are determined. System checks Actual Agent defined in workflow runtime with the Possible Agents defined in the task and the Excluded Agents. There are basically three types of Agents: Actual Agent: One who actually takes the action. Each and every standard task is associated with a Business Object and a method. else Agent resolution fails. Possible Agent: All possible persons/entities who are authorized organizationally to start a task and execute the relevant work item. This is provided in the workflow Activity. Organizational data: It’s also configuration. 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.When an exception situation occurs (LIS exception)  Business Transaction Events (SWU_EWBTE) – When financialdocuments are being created.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. 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.SWE_EVENT_CREATE or SAP_WAPI_CREATE_EVENT  Change documents (SWEC) . no ABAP code only defined value  ranges are assigned to agents. SAP  Organizational Object Types are used to assign agents.Event creation as message type (SE91)  Logistics Information System (AWUW) . Event creation upon status changes  Message control(SWUY) . 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? .When change documents are written  General Status Management (BSVW)-. no ABAP code is required. The possible ways of creating events are: Through Function module . Responsibilities: It’s a pure configuration.  HR Master Data (SWEHR1/2/3) . Example: Creation of Sales order. We can monitor the workflow steps in four ways: Requested start – Workitem is not available in the inbox until the predefined schedule is reached. Wait. Loop(Until). Document from Template. Latest end – Workitem must be completed by predefined step else deadline missed message will come for the particular workitem. . Requested end – Minimum time on task. Step Types that can be inserted in the workflow are: Activity. Local Workflow etc. Event Creator. Latest start – Workitem must be started by predefined schedule. 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. Form. Multiple Condition. Type W (Work item with dialog). Block. Condition. Process Control.A step types are the entities used in the workflow which gives the predefined results whenever executed. Container Operation. User Decision. The Step Types appear in the Objects section of the workflow builder or simply right click on the builder and choose insert option. What is Deadline Monitoring? · · · · Monitoring the workflow steps according to our predefined schedule is referred as Deadline Monitoring. 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. web activity. There are many types of workitem but only three type of workitem appear in the business workplace (Inbox). Send Mail. Fork. D (Deadline Missed) and A (Work Queue). events and attributes to your sub type.Main Workflow Builder.Display the address of the user or recipient SWW_WI_DELETE .The Business Workplace SWDM .Remove lock against execution of workitem T-Codes related to Workflow? SWLD .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.Create work item as result of event SWW_WI_DEADLINE_CHANGE . Binding: Assignment between the elements of two different containers (Event Container/ Workflow Container/ Task Container/Method Container/ Rule Container) is referred as Binding.Lock workitem against execution SWW_WI_ENABLE . Basic Function Modules in Workflows? SWW_WI_POPUP_FOR_COMPLETION .Retrieve event for a workflow SWW_WI_DISABLE . PPOC – Organization Maintenance. PFTC .Delete work item SWW_WI_CREATE_VIA_EVENT .Change of deadline attribute of work item SWW_WI_COMP_EVENT_RECEIVE .Business Workflow Explorer SWU3 – Workflow Customization. Container: It’s a storage place where all the values associated with variables or structures are stored (import or export).Lists all the transactions associated with Business workflows. SWDD .Reject work item SWW_WI_EVENT_RECEIVE .Complete workitem using events SWW_WI_REJECT .General task Maintenance. .Shows the completed status of a workflow SWW_ADDR_KEY_CREATE_FROM_USER . SBWP . Work Items with Monitored Deadlines SWI2_DURA .Workflow Analysis.Change PFTC_DIS .Create PFTC_CHG .Switch Event Trace On/Off SWUS . SWPC – Continue Workflow after System Crash. SWO1 .Logistics Information System (LIS) Event Linkages SWB_COND .Status management NACE . T-Codes related to Task: PFTC_INS .Message Control AWUW .Display PFTC_COP . SW06 .Delete T-Codes Related To Events: Events Creation BSVW .Work Items per Task SWI2_DEAD . SWWL – Delete Workiiem. SWI1 to 8 .Display/Maintain Event Type Linkages SWELS .PFAC – Rule Maintenance.Copy PFTC_DEL .Start Workflow SWPR – Workflow Restart after error.Delegation SWEL/SWETYPV .Business Object Builder.Workflow Start Conditions Work item analysis: SWI2_FREQ .Test Workflow SWUI .Work Items by Processing Duration Background Jobs: . SWWERRE: Work item error monitoring. SWWDHEX: Work item deadline monitoring. SWEQSRV: Managing the correct processing of the event queue. SWWCLEAR: Clearing tasks in the workflow system. .WF-BATCH: Default background user (Not a T-Code) SWWCOND: Work item rule monitoring.
Copyright © 2024 DOKUMEN.SITE Inc.