The full life-cycle of an event shows it's true colors. This article may help you inderstand some of the mystical manners of events.
The life of an event When an event is created, it has a life of it's own - until it triggers (e.g.) a workflow. This is the sequence of events that happen to an event:
- A change document is written for which an event had been set up, once the subject of the change document as well as the change document itself has been stored on the database (tables
CDHDR
&CDPOS
) the event is processed - (Only for events triggered from change documents) the Object Type of the linkage is determined (if it is not already set up) via a function module like
SWE_CD_TEMPLATE_OBJTYPE_FB
set up on transactionSWEC
. - (Only for events triggered from change documents) the Event ID (name of the event) of the linkage is determined (if it is not already set up) via a function module like
SWE_CD_TEMPLATE_EVENT_FB
set up on transactionSWEC
. - (Only for events triggered from change documents) the event container for the event linkage can be enriched with elements that have been defined (as parameters on the event definition, which can be found on the business object) via a function module like
SWE_CD_TEMPLATE_CONTAINER_FB
set up on transactionSWEC
.
Note: To this point all actions are about the event. From here on it's all about "event linkages" (recievers) - The receiver type function module is called (when it is supplied in transaction
SWETYPV
) - this function module determines which reciever types (E.g. workflow WS91000067) are to be linked (hardly ever used) - In transaction
SWETYPV
, the destination of a receiver can be maintained - this will effectively trigger the event on a logical RFC destination... - For every event linkage (read: event linked to a reciever for e.g. triggering a workflow or several workflows) a function module to check whether the event should be stopped is executed (only when it has been set up on transaction
SWETYPV
).
See Check event linkage - function module - Starting conditions are checked (only when the function module for the previous step is not set up). Transaction
SWB_COND
holds the starting conditions for an event/workflow combination in a graphical and readable manner. The transaction also allows creating and changing start conditions. - (Only for events that allow event queue usage) the event is now placed in the event queue (see transaction
SWEQADM
). - Events will be processed (directly or via the batchjob behind the event queue).
- By now the event linkage is really triggered/raised. This is done via a function module call which is set up in transaction
SWETYPV
as well, normally set up for function moduleSWW_WI_CREATE_VIA_EVENT_IBF
. So effectively, via a linkage the event mechanism of workflow could be used to do anything... - Events always belong to a business object, for which an instance is now created. Only if the method ExistanceCheck on the business object from the event returns a valid result - can the event be processed further (errors will show in the event log)
- (Only if the event trace is active) An entry will be added to the event trace (this is where it shows what happened to the event or why it was ignored). See transaction
SWEL
andSWELS
- The workflow which is set up to trigger from this event will be started and normally the Business Object behind the event will be placed into the workflow containes (along with any other event container elements).
- That's it - the life of the event is over...