Step 2: Flexible Event Creation

In the scenario that forms the basis of this tutorial, a link is to be created between a status change in an object (in this case, change in the material master) and a subsequent reaction (in this case starting a single-step task).

The section entitled

Step 5: Defining a Single-Step Task

introduces you to linking a triggering event to a single-step task.

Firstly, however, you must ensure that an event is actually created when the field WRKST in the master data table MARA is changed, in other words when the status of the object is changed.


In the section

Step 1: Identifying and Extending Object Types

you defined the event WrkstChanged as an extension to the object type ZXX_MARA. You created this object type as a subtype of object type BUS1001 because no extensions can be made to the object types supplied by SAP.

This formally published the event WrkstChanged in the object repository. This is a prerequisite for creating this event and using it as a triggering event.

All events defined for an object type in the object repository and supplied by SAP are created when the appropriate status change occurs.


Event creation when change documents are written

The event WrkstChanged is to be created when the content of the field Basic material changes.

As the application logs the change as a change document, the event creation can be catered for by linking to the writing of the change document.

The change document is written when the change takes effect on the database.

The procedure above, which locates the event after the logging, therefore ensures that the event is not created until the change has actually been completed.

The following entries are required to create an event when a change document is written.

Make these entries during the tutorial.

1. In the workflow area menu for developers (transaction SWLD), choose Definition tools ® Event creation ® Change documents ® Linkage.

2. In the first view Events for change document, follow the menu path Edit ® New entries.

3. Make the following entries:

Change document object: MATERIAL

Business object type: ZXX_MARA

Event: WrkstChanged

4. Determine that the event is to be created when a change is made.

5. Select the view Field restrictions.

You go to Change View "Field Restrictions for Event Creation": Overview

6. Choose Edit ® New entries and make the following entries in the section Field restrictions for event creation:

Table: MARA

Field name: WRKST

Old value: *

New value: *

The event is then created each time the field Basic material is changed.

7. Select Save and exit view maintenance.

Test for event creation

You can now test whether the event creation is successful.

Make sure that the event log is activated. To do this, in the workflow area menu for developers (transaction SWLD), choose Utilities ® Events ® Event log ® On/off and correct the setting if applicable.

Then carry out the steps at the end of the introductory section to change the material master data.

Then call the event log again. This time choose Utilities ® Events ® Event log ® Display and select the events created with the date. At the end of the list you will find "your" object type with the event created. No receiver is entered of course.


In this section you have catered for the creation of an event by linking to the writing of change documents.

This procedure transfers consistency checks to the application and is suitable for customer-specific enhancements.

In much the same way, it is possible to link the creation of an event to general status management.

It is possible to ensure that an event is created each time an object status is changed.