Examples of event rules based on IDocs

The following example applies to the scenario described in Business scenario. It shows an event rule that triggers an import ABAP report when an IDoc is added with a message type corresponding to emergency orders.
<?xml version="1.0" encoding="UTF-8"?>
<eventRuleSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns="http://www.abc.com/xmlns/prod/tws/1.0/event-management/rules"
              xsi:schemaLocation="http://www.abc.com/xmlns/prod/tws/1.0/
                  event-management/rules EventRules.xsd">
        <eventRule name="scenario1_IDoc" ruleType="filter" isDraft="no">
          <eventCondition name="IDocEventRaised1" eventProvider="SapMonitor"
                          eventType="IDocEventGenerated">
             <scope>
                   001 ON SAPCU WITH 2
             <scope>
             <filteringPredicate> <attributeFilter name="Workstation" operator="eq">
                    <value>SAPCPU</value>
                </attributeFilter>
                <attributeFilter name="SAPClient" operator="eq">
                    <value>001</value>
                </attributeFilter>
                <attributeFilter name="SAPIDocStatus" operator="eq">
                    <value>50</value>
                </attributeFilter>
                <attributeFilter name="SAPDirectionIDocTransmission" operator="eq">
                    <value>2</value>
                </attributeFilter>
                <attributeFilter name="SAPLogicalMessageType" operator="eq">
                    <value>EORD1</value>
                </attributeFilter>
            </filteringPredicate>
          </eventCondition>
          <action actionProvider="TWSaction" actionType="sbj"
                  responseType="onDetection">
            <description>Trigger immediate report for high priority orders
            </description>
            <parameter name="JobDefinitionWorkstationName">
              <value>MASTER84</value>
            </parameter>
            <parameter name="JobDefinitionName">
              <value>triggerimport</value>
            </parameter>
          </action>
        </eventRule>
</eventRuleSet>
The following example shows an event rule defined to create a ticket for failing IDocs in the SAP Solution Manager or any other problem management system: when an IDoc with a syntax error is detected, the engine submits a job to create a ticket for the failing IDoc.
<?xml version="1.0" encoding="UTF-8"?>
<eventRuleSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns="http://www.abc.com/xmlns/prod/tws/1.0/event-management/rules"
              xsi:schemaLocation="http://www.abc.com/xmlns/prod/tws/1.0/
                  event-management/rules EventRules.xsd">
        <eventRule name="scenario1_IDoc" ruleType="filter" isDraft="no">
          <eventCondition name="IDocEventRaised1" eventProvider="SapMonitor" 
                          eventType="IDocEventGenerated">
             <filteringPredicate> attributeFilter name="Workstation" operator="eq">
                    <value>SAPCPU</value>
                </attributeFilter>
                <attributeFilter name="SAPClient" operator="eq">
                    <value>001</value>
                </attributeFilter>
                <attributeFilter name="SAPIDocStatus" operator="eq">
                    <value>60</value>
                <attributeFilter name="SAPDirectionIDocTransmission" operator="eq">
                    <value>2</value>
                </attributeFilter>
                </attributeFilter>
                <attributeFilter name="SAPLogicalMessageType" operator="eq">
                    <value>MYORD1</value>
                </attributeFilter>
            </filteringPredicate>
          </eventCondition>
          <action actionProvider="TWSaction" actionType="sbj"
                  responseType="onDetection">
            <description>Create a ticket for failing IDocs
            </description>
            <parameter name="JobDefinitionWorkstationName">
              <value>MASTER84</value>
            </parameter>
            <parameter name="JobDefinitionName">
              <value>createticket</value>
            </parameter>
          </action>
        </eventRule></eventRuleSet>