|Home • Trainings • Quiz • Tips • Tutorials • Functional • Cert Q's • Interview Q's • Jobs • Testimonials • Advertise • Contact Us|
Program Exits in Work Item for Workflow
By Anirban Bhattacharjee, KPIT Cummins and Infosystems
The purpose of this document is to demonstrate how to use Program Exits in a
Work Item for Workflow.
Scenario: Many times we have scenarios where we want to do some
additional custom processing when a work item is created or executed.
SAP has given us a way by which we can design Program Exits
in a work item. The events on which we can program this are mentioned below
We will see that the class we will model later on in this
tutorial will contain the methods that can be implemented for handling the above
we will send e-mail via this Program Exit once when a work item is created and
once when it is executed.
There will be no e-mail steps modeled in the workflow. They
will happen solely from the program exit.
to design the Program Exit in a Work Item
Let us look at the tab in a work item where this exit is
Note that the SAP Documentation states that the class that
will be modeled here must support the IF_SWF_IFS_WORKITEM_EXIT
interface. Please ensure that inside this class we will not be using any ABAP
Instruction that can release the current LUW like COMMIT WORK, ROLLBACK WORK or
using RFC Function Calls.
Now we will design a class via the transaction SE24. We will
call this class ZZCL_WORK_ITEM_EXIT.
tab of the class will look as shown. We will add the type group SWRCO
We will now declare the interface IF_SWF_IFS_WORKITEM_EXIT in the interface tab
Once we declare the interface, the attributes related to this
interface will appear in the Attributes
Notice the events that can happen with a work item in the Description
column. This is what was
mentioned at the start of the tutorial.
We will now add a couple of custom attributes as mentioned
as a type reference to IF_WAPI_WORKITEM_CONTEXT;
this interface returns the various attributes of a work item.
Displaying this interface via SE24 and showing you the methods
To see how to implement these methods in a class, please
This class is very helpful to understand how to do various
operations on a work item.
The other custom attribute will be named PROCESS_STATUS.
This will contain a default value ‘sap.bc.bmt.wfm.process.status’.
The attributes tab now looks like as shown below
Both the attributes are Instance
Attribute and Private
Now let us navigate to the Methods Tab of this
The only method created by default is EVENT_RAISED. This will be called whenever the Work Item Events
(mentioned at the start of the tutorial) are triggered.
The parameters that appear in this method are
(Note that there is a parameter IM_WORKITEM_CONTEXT which refers interface IF_WAPI_WORKITEM_CONTEXT)
Now we will create two more methods called AFTER_WI_CREATION
and AFTER_WI_EXECUTION as shown.
Both the methods are Instance
Method with Private
Please send us your feedback/suggestions at webmaster@SAPTechnical.COM
©2006-2007 SAPTechnical.COM. All rights reserved.
product names are trademarks of their respective companies. SAPTechnical.COM
is in no way affiliated with SAP AG.
Graphic Design by Round the Bend Wizards