Sample Collection Guide > Reaction to External Events

Reaction to External Events

Objective: A SAP event should be reported to the AE system in order to facilitate a reaction to it.

Objects used: Console event, Notification

Script elements used: ACTIVATE_UC_OBJECT, GET_EVENT_INFO, PRINT


Example

Object types include events of type "Console". These are available for some of the AE-supported platforms, such as z/OS or Windows, and monitor their Console outputs. You can integrate this function in your AE system in order to react to events that were not started by AE. This is illustrated in the SAP event shown below. An operator should be informed when a transport is made to a productive SAP system.

Events

First, a Console event is required which monitors the triggered SAP events. We want to react if a transport is made. The SAP system triggers the event "SAP_IMPORT_START" in such a case. Every time the agent informs the Console event, the content of !Process is executed. This means that a reaction to the triggered SAP event is possible with statements stored in !Process.

Create a Console event. The Console tab includes the main specification for this object. Select the agent which is connected to the SAP system. Specify the selection criteria for the SAP events to be monitored in the lower table area. You can specify particular events or define filters using the wildcard characters  "*" and "?"; you can even use several lines. In this example, we use one line. Enter the Event ID "SAP_IMPORT_START" and complete the fields "Event Parameter" and "Event Server" according to your SAP system.

The following illustration shows the complete Console tab:

Notification

There are numerous ways of reacting to a triggered SAP event. For example, you can start subsequent processing using a workflow. In this example, we inform a user with a notification.  

Create a Notification object. Select the user to be informed and write a suitable message text. Specify the notification's priority and type.

Event

In the Console event, click  the !Process tab. We want to store detailed information about the SAP event in the report and activate the notification. Information can be stored using the script function GET_EVENT_INFO. Depending on the assigned parameter, it supplies particular information about the SAP event. Several keywords are available which are listed in the document describing this script function. The agent informs about the SAP events in the interval which the administrator defined with the setting JOB_CHECKINTERVAL. We want to know the time when the SAP event was triggered and we retrieve the complete event parameter and server because we have specified both filters in the Console event. Then activate the notification "CALL.SAP_IMPORT_START".

:SET &timestamp# = GET_EVENT_INFO(TIMESTAMP)
:
PRINT "timestamp: &timestamp#"
:
SET &parameter# = GET_EVENT_INFO(EVENT_PARM)
:
PRINT "Event_parameter: &parameter#"
:
SET &server# = GET_EVENT_INFO(EVENT_SERVER)
:
PRINT "Event_server: &server#"

:SET &ret# = ACTIVATE_UC_OBJECT(CALL.SAP_IMPORT_START)

Information about the SAP event can also be passed to the notification. More detailed information is provided in the sample:  "Notification with Variable Message Text".

The report of the process execution is structured as follows: