Show TOC

Modeling EventsLocate this document in the navigation structure

Use

In process modeling, an event is a flow object that indicates that something happens in the course of the process. The events in the process have different triggers and results and affect the flow of the process. You use events to indicate that a process has started or ended, or that the flow is delayed and is waiting for a certain time before resuming. You can also use events to represent the interaction between different processes.

To model a process, you create the following event types:

  • Start event, which indicates the start of the process you are modeling and has no incoming sequence flow.

    The process starts when the start event is triggered.

  • End event, which indicates the end of the process you are modeling and has no outgoing sequence flow.

    The process ends when the end event is reached. If a branch in the process reaches a termination end event, all parallel flows in the process are also terminated.

    You use error and escalation end events to model an exception that occurs in the process. For more information about error and escalation end events, see Modeling Exceptions and Exceptions Handling .

  • Intermediate event, which occurs between the start and the end event and has an incoming and an outgoing sequence flow.

    The intermediate event affects the process flow, but it does not start or terminate it.

    You use intermediate timer events to indicate that the process pauses and resumes after a specified time or on a specified date.

    You use intermediate message events to indicate that the process waits for an external message before it resumes. You can model, for example, a purchase order process and use an intermediate message event that waits for a payment confirmation message before the process resumes.

  • Boundary event, which is a specific type of event, triggered by an exception in the process. The boundary event has an outgoing sequence flow only and is attached to the boundary of an activity. You use it to catch an exception that has occurred while the activity was performed. The outgoing sequence flow from the boundary event shows how the process continues after the exception has occurred.

When you model events, you proceed as follows:

  • Create the event.

  • Assign a trigger to the event or configure the trigger time for intermediate timer events.

    You use triggers to indicate what is the reason for an event to happen, for example a message, or an exception. For more information about event triggers, see Creating Reusable Event Triggers .

    Note

    The trigger you assign to an intermediate message event must be created from an asynchronous service operation, because the intermediate message event cannot send back a response to the message sender.

  • Define a start condition for a message start event and a correlation condition for an intermediate message event.

    • Start condition

      You may configure a start condition for start message events to specify which particular message starts the process. The start condition compares the payload of the incoming message to some constant. You can enter, for example, a start condition such as event/order/value > 10000 , which means that the process is started only if a value higher than 10000 is received. If the start condition evaluates to "false", the process is not started.

      You can also use the default value "true", which means that any message can trigger the start event.

    • Correlation condition

      If you use intermediate message events in your process, you have to configure correlation conditions for them which are evaluated once a message is received. If the evaluation succeeds the message is consumed and the process flow continues. For more information about how to define correlation condition and how the messages are received and consumed from intermediate message events in the process flow, see Correlation for Intermediate Message Events .

      Note

      You can define the same message endpoint for a message start event and an intermediate message event. This way, incoming messages are received and consumed as long as there is a running instance. If no instance exists, the first incoming message starts a new one if the start condition is fulfilled. Subsequent messages are received and consumed by that instance.

  • Define input or output data mapping, depending on the event type.

Prerequisites

You have opened the Process Development perspective in the SAP NetWeaver Developer Studio and have expanded your project in Project Explorer view.

Procedure

Creating the Event

  1. Expand Process Modeling , then expand Processes .

  2. In the context menu of a process, choose Open .

  3. Expand Flow Objects from Palette .

  4. Choose an event from one of the dropdown lists with event types and click the modeling surface.

    The event appears in the place you clicked.

  5. Choose General in the Properties view and specify a name of the event in the Name field.

  6. (Optional) Define a start condition for the message start event or a correlation condition for the intermediate message event that is different from the default condition, which is "true". To do that, open the Start Condition or respectively the Correlation Condition tab page in the Properties view of the start or intermediate message event, and define the condition with an expression. For more information, see Creating Expressions and Correlation for Intermediate Message Events .

  7. (Optional) Specify a description of the event in the Documentation field.

Caution

If you use context nodes in your expression from different namespaces with equal names, you have to declare the namespaces of these nodes. To solve the name conflict you can define a name prefix for the namespace. This declaration has the following syntax: xmlns:<prefix_name>="namespace_name" .

Assigning a Trigger to the Event

A default trigger is automatically assigned to every event you create in the process, except for the events that have no specific trigger. The default trigger enables you to easily model an executable process if you have not created other event triggers. This procedure describes how to assign another trigger that is different from the default one to an event.

Note

You cannot change the default trigger assigned to an intermediate timer event, but you can define a trigger time for the intermediate timer event. To do that, open the Timer Configuration tab page in the Properties view of the intermediate timer event and define the trigger time with an offset or with an expression that is evaluated in milliseconds.

  1. Expand Process Modeling , then expand Processes .

  2. In the context menu of a process, choose Open .

  3. In the modeling surface, choose an event.

  4. In the Properties view, open the Event Trigger tab page.

  5. Select a trigger type with the respective radio button.

    The available trigger types depend on the event you are modeling and its location. For example, if you are modeling a start event in the main process, the only available trigger types are Message and None . All other trigger types are greyed out.

    Note

    Only processes with a message trigger assigned to the start event can be built, deployed and executed.

  6. Select a trigger from the Trigger dropdown menu.

    The dropdown menu contains the available triggers depending on the trigger type you selected by a radio button.

    In case you select an error trigger, the message trigger to which the error belongs is also shown in the Trigger dropdown menu following the naming convention <Error trigger Nname> - <Message trigger name> .

    Recommendation

    You can use, for example, the DefaultService_Empty message trigger, which is assigned to message start and message end event by default. We recommend that you use it when you want to start the process only via the process repository in SAP NetWeaver Administrator. In this case, you search for the process you want to start by process name.

    You can also use the Web Services Navigator (WS Navigator) to start a process. In this case, you search for the specific trigger that starts the process. We recommend that you create triggers with descriptive names based on service interface definitions you create or import. As a result, you ensure finding the right trigger and service interface to start a particular process in the WS Navigator. For more information, see Starting a Process .

  7. (Optional) Make an end event terminating.

    To do that, select the Terminating checkbox on the Event Trigger tab page in the Properties view. The image of the event you selected changes to Termination in the process model and in the Outline view.

    If a branch of the process reaches such a terminating end event, all parallel flows in the process are also terminated.

Note

Message start and end events in the process have the same message trigger assigned. When you change the message trigger you have assigned to a start event with another message trigger, the message trigger of the end event is also automatically changed.

You can also assign the same message trigger to start and intermediate message event in a process. In this case, a new process instance is started only if there is no existing instance where an intermediate message event expects the particular message.

Defining Data Mappings

You can define:

  • Output Mappings - for message start and intermediate message events

    You can define output mappings for an intermediate message event from the message payload to the process context. These transformations would be executed at runtime when the running process instance receives a message call with payload, it is not in suspended state (with In Progress status), and reaches the intermediate message event.

  • Input Mappings - for end events such as message end, escalation, and error

For more information, see Defining Data Mappings .