You are on page 1of 11

Workflow Tracing the events executed in a SAP transaction By A K Singh In the article we learned about triggering the events

programmatically in our custom programs. But SAP has already provided with many events in almost all the standard SAP transactions like: 1. 2. 3. When a material is created, a standard event is triggered When a Purchase Order is created, an event is triggered. When the status of a production order is changed, an event is triggered.

We can link the events to either standard workflows or custom workflows to carry out our business requirements. Before linking the business workflows to events, we would need to trace the events that are triggered in a transaction. This document explains the procedure in tracing the events for the Material Master transaction (MM01). We would trace the events that are triggered when a Material is created using MM01. 1. Go to transaction SWELS. A pop-up screen as shown below would appear:

2.

Click on Switch on. The event trace would be on now.

3.

Keeping this event trace on, create a material using MM01.

4.

Now go to transaction SWELS and click on Switch Off to switch off the event trace.

5.

Go to transaction SWEL to get the list of events triggered during the Material creation.

6.

Click on Execute.

The list of events that are triggered are shaded in green. A workflow object (shown in yellow) is also triggered as it is attached to the event CREATED belonging to the business object BUS1001006.

Ad Hoc agent assignment in Workflow By Sathis Kumar R, Quintegra Solutions This Article is about the Adhoc Agent Assignment for workflow. The workflow initiator assigns a recipient to the steps in the workflow at runtime. Scenario: Assigning Adhoc Agent for the task " create the leave form". Step by step: Create the new workflow named as "wf_4adhoc "

Drag and drop the activity from the step type.

Now create a new task for leave form. In that give your own abbreviation and name for the task. Object Category Object Type Method : BOR Object : FORMABSENC. : CREATE.

Now save the task and go back .Now the binding between the task and the workflow was shown like.

Click ok (Tick mark) button. Now the task complete option was active.

You don't fill any agent for this task. You leave it as empty as shown in the figure. Now we move to the Task properties. Click the agent assignment icon. I would like to explain about creating custom rules in SAP Workflow. The rules can be created or changed using the standard SAP transaction PFAC. Once the rules are created you can call these rules in any workflow via the rule container. In this article I am creating a rule, which will find the users based on Position id. I have created a custom function module ZWF_FIND_USERS which will return me back a position under Asset Analyst (HRP1001SOBID). The custom function created should have the same interface as that of the SAP standard function module RH_GET_ACTORS. The following table parameters have to exist in the custom function module. ACTOR_TAB STRUCTURE SWHACTOR AC_CONTAINER STRUCTURE SWCONT Following is the function module code: FUNCTION ZWF_FIND_USERS.

*"----------------------------------------------------------*"*"Local Interface: *" TABLES *" *" ACTOR_TAB STRUCTURE SWHACTOR AC_CONTAINER STRUCTURE SWCONT

*" EXCEPTIONS *" NOAGENT_FOUND

*"----------------------------------------------------------INCLUDE <CNTN01>. DATA : POSITION_ID LIKE ZBUSAREA-OBJID, LT_HOLDERS TYPE STANDARD TABLE OF SWHACTOR, LWA_HOLDERS TYPE SWHACTOR, LWA_USERS TYPE STANDARD TABLE OF HRP1001, WA_USERS TYPE HRP1001, NUM_LINES TYPE I. *Read values assigned to the rule criteria SWC_GET_ELEMENT AC_CONTAINER 'POSITION_ID' POSITION_ID. SELECT * FROM HRP1001 INTO table LWA_USERS WHERE OBJID = POSITION_ID. IF NOT LWA_USERS IS INITIAL. REFRESH LT_HOLDERS[]. loop at LWA_USERS into WA_USERS. Condense WA_USERS-SOBID. LWA_HOLDERS-OTYPE = 'US'. LWA_HOLDERS-OBJID = WA_USERS-SOBID.

APPEND LWA_HOLDERS TO LT_HOLDERS. APPEND LINES OF LT_HOLDERS TO ACTOR_TAB. endloop. ENDIF. DESCRIBE TABLE ACTOR_TAB LINES NUM_LINES. IF NUM_LINES IS INITIAL. RAISE NOAGENT_FOUND. ENDIF. ENDFUNCTION. Creating a rule using the PFAC Transaction Assign the function module ZWF_FIND_USERS in the "Rule Definition Tab"

Go to the "Container Tab" and create a container element for the Position id which will be passed to the function module

Our rule is created now. You can test the rule within the PFAC transaction by clicking the "Simulation" button on the application toolbar. Now this rule is ready to be used in any workflow according to your requirement via the rule container of the workflow.

Enter the Position Id, which is created in (PPOCW)

It displays Asset Analysts (users) in the Rule resolution result

Now you can use this rule in any of your workflow definitions.

You might also like