SAP Business Workflow allows you to seamlessly integrate
various business processes, enabling you to carry out multiple tasks at the
correct moment. The chronological order and prompt execution of such procedures
are guaranteed even when multiple parties are involved.What makes this all happen is the timely response of the Workflow Management System to the occurrence of predefined events in the SAP system. Event handling is the core of SAP Business Workflow. No matter what your role is in an SAP R/3 implementation, having knowledge of the events and how they are handled is indispensable.
While the details of event creation are beyond the scope of this article, you must familiarize yourself with events as they are interpreted within the SAP landscape and the various elements of SAP that make event processing possible.
Events: Technical background
Events are defined as signals that inform you about the adaptation in the state of a business object. All programs in the SAP system are made aware of the occurrence of an event. Workflow allows any number of programs (event receivers) to respond to a generated event, and those programs may react to the event in their own way.
Workflow steps may be triggered as a reaction to events. When an event is created, workflow steps may be initiated, terminated, or continued. When, for example, an employee's address changes, a workflow automatically sends an e-mail to the employee's supervisor with the new address. Typical examples of events are shown in Figure A.
Figure A
|
Events are defined in the Business Object Repository (BOR) as components of an object type. You can define any number of events for a particular object, and you can use the BOR to view a list of events created for a particular object type.
If the standard SAP events don't fulfill your purpose, new events may be added to the given object type. SAP doesn't allow changes to its original object types. It permits changes by using the concept of delegation. Delegation, as the name implies, is a technique of replacing an original object type by its subtype to which additional events may be added.
SAP leverages an elegant set of tools dedicated to event processing. Let's take a look at the various elements of SAP R/3 involved in an event-related scenario.
Event creator programs
Before a program or a workflow task can respond to any event, the event must be created. Programs that generate or create such events are known as event creators, which call the function module SWE_EVENT_CREATE for the creation of events. Let's consider the hiring of an employee as an example. Suppose a program hires an employee and then creates an event named hired via the function module.
Our hiring program may be run for multiple employees simultaneously. The hiring program—when run for each employee—would be creating separate events, each having a distinguishable ID.
The presence of interested receivers is not a rule for event creation. Event creator programs are simply unaware of any possible programs willing to respond to a particular event. The Object key (for example, employee number 123) and the Event ID are important information that the creator program offers to its prospective receivers.
Special care should be taken while writing event creators since it must be ensured that the events aren't generated until the state of an object has actually been changed. In our employee-hiring example, the event—hired—should be generated only when the hiring process has completed without any errors.



















Hello,
This is a great article but there is somthing else i wanted to know about workflow - can it be used to enhance automatic processing of object and not just for notification?
(for ex. when an employee is "hired" to automatical activate an ALE transaction sending an IDOC to create a user for him in the right system?)
any opinion ?
Posted by Uri Lifshitz on Wednesday, July 23 2003 11:16 PM