Skip to main content

React to a change in SAP

"Artikel Webshop" ran by the clock for a quarter of a year: every morning at 06:00 a full run over the whole item master. Anyone who corrected a price at nine saw it in the shop the next morning. On June 24, 2026, at 9:35 AM, the schedule was removed and replaced by an event trigger. Since then, the price correction goes out the moment it is saved.

In what follows, you attach an event trigger to a route that reads its data from SAP Business One.

The pace then comes from an event instead of the clock — and with that, what an ordinary run is changes. A schedule collects: one run a day, with as many jobs in it as have changed. An event starts a run of its own for each single change, with exactly one job in it. In the 24 hours of October 8, that was 141 runs and 141 jobs for "Artikel Webshop" — the same number twice.

Distinction

Here, the event sets the pace. If the route is to run at fixed times instead — at two in the morning, early on Sundays — the way is described in Run on a schedule.

What you need​

  • An export or internal route. An event trigger is only possible on a route that reads from SAP Business One. On an import route, the Choose trigger type dialog offers only Scheduled, without comment. If you turn a route's direction afterwards, the message "An event trigger is only available for export and internal routes" appears. An internal route that creates the object its event listens to can trigger itself again — what to do then is in Routes — Automation.
  • A route whose data is in SAP Business One and that has a Fetch endpoint. Only such routes listen to SAP events; a route that works through a queue or has its data assigned by another route stays out of it.
  • Three permissions, each at the Full level: Routes creates the trigger, Activation activates the snapshot, Automation releases the route at the end — see Permissions.
  • The Automation tab of the open route. There, the triggers are in a list on the left, their settings on the right.

Xchange saves every entry automatically. In operation, it takes effect only with the activated configuration snapshot.

1. Create the event trigger​

  1. On the route's Automation tab, choose Add trigger at the top right. The Choose trigger type dialog opens.
  2. Choose Event — "Reacts when a record is created or changed." — and confirm with Select.

The form appears on the right. In the list on the left, the new entry shows as Event; as soon as the next step is done, the name of the object it listens to appears below it.

2. Say what it reacts to​

The first field of the form is a toggle bar with three positions — it sets the trigger's operating mode:

  • Same as fetch endpoint — the trigger listens to the same object the route reads anyway.
  • Other object — it listens to a different one.
  • Custom procedure — a procedure stored in the SAP system decides.

For "Artikel Webshop", the first position is the right one: the route reads the item master through the fetch endpoint Items, and exactly its changes are to start it.

  1. Set the operating mode to Same as fetch endpoint.
  2. Under Trigger on, switch on both buttons Created and Changed. A switched-on button is highlighted. At least one of the two must be on — otherwise the validation flags the trigger.

The event trigger with both cases switched on.

A red hint below the bar?

"The route's fetch endpoint raises no SAP event." Then this route needs a different operating mode or a different fetch endpoint before it can be activated. Switch to Other object and choose an object that meaningfully starts the route — the section further below describes this. Or have the route read through a fetch endpoint that raises an event.

In this position, that is all set: object, key field and restriction come from the route. Below the bar is the corresponding hint — "The trigger uses the route's data filter. Change it on the 'Source data' tab." For "Artikel Webshop", the data filter is empty, so the trigger listens to every item change in the company.

3. Where the record comes from​

An SAP event only reports that something has changed, and names the key with it. Xchange therefore reads the record itself afterwards, through the route's Single-fetch endpoint.

For a route whose data is in SAP Business One, this field is filled from the Fetch endpoint and is read-only: Items becomes Items('{{ItemCode}}'). The field is thereby fully set up. If, on the other hand, the route is on a connection that derives its addresses differently, the field becomes required, and the validation demands it before the snapshot can be activated.

4. Validate, activate, release​

A route starts only once its snapshot is activated and the automation is released.

  1. Validate and activate the draft — the way is described in Validate and activate.
  2. Switch to Execution and flip the switch in the Automation column for this route.

From now on, every change to the object starts a run. Whether the first of them went through cleanly you see right away — Check whether a run went through cleanly.

What then shows under Recent runs​

Two things look different than on a route running on a schedule, and both belong to this design.

Many short runs instead of a few long ones. On October 8, "Artikel Webshop" counted 141 runs with one job each. A table that fills up throughout the day is the normal state here.

Skipped jobs. 33 of the 141 ended as Skipped (no change). The SAP event fires on every change to the item — including one that touches only fields outside the mapping. Then there is nothing to write, and the job ends skipped. The run itself still stands as Succeeded; the Jobs column names the skipped job. If you want to narrow this down, do so in the route's data filter or with the Other object operating mode and conditions of your own.

Three successful event runs with one job each, the most recent one skipped.

And the Message ID is missing on such a job. It belongs to a message that came in from outside; here, an event within the company started the job. The way to the single job is described in Find and trace a single job.

When the trigger is to listen to something else​

The two remaining operating modes are there for the cases in which the change to an object other than the one the route reads is what counts.

Other object. Here you choose Object and Fetch-key field yourself, and below them is the same condition builder as in the data filter — Add group, Add condition. Above it is the hint: "The source data filter does not apply to this trigger. Only the conditions below decide. Add any restriction that is also meant to apply to the event there." Some fields carry the addition Only evaluable on fetch in the picker — they are available only on fetch, after the event.

Custom procedure. You choose the object and Trigger on as for Other object. Instead of the conditions, you enter a Procedure name; the decision whether an event starts the route is then made in this procedure. The Generate template button gives you the framework for it.

The fields of both operating modes in detail are described in Routes — Automation.

What comes next​

Whether the first run that an event triggers went through cleanly is shown by Check whether a run went through cleanly.

See also​