<?xml version="1.0" encoding="utf-8"?>
<ManualTopic ID="/baanerp/da/onlinemanual/trg_examples_xml" xml:lang="en">
	<Header>
		<Title xmlns:HTML="http://www.w3.org/TR/REC-html40">XML used at runtime</Title>
		<Keyword ContextSensitive="No"><Level1>Triggering</Level1>
			<Level2>Example</Level2>
		</Keyword>
		<Keyword ContextSensitive="No"><Level1>i-Flow</Level1>
		</Keyword>
	</Header>
	<GeneralSection><SectionTitle>Introduction</SectionTitle>
		<Paragraph class="Default">In ERP, a job is created to regularly run the Exchange export process, for example, every ten minutes. Based on this setup standard create, change and delete events will come out.</Paragraph>
		<Paragraph class="Default">The event XML is defined in Chapter 3, "Event Handling." Below this XML structure is applied to the business case. Note that the end of data set event is not used for the business case.</Paragraph>
		<Paragraph class="Default">The following two transformation examples illustrate each of the two cases. In the first example, the transformation script renames the event type, renames the attributes, and moves the previous values. In the second example, the transformation script replaces the event with a workflow-specific structure.</Paragraph>
		<Paragraph class="Default">Optionally, the user can add an event time to the control area, such as:</Paragraph>
		<Paragraph class="Default"><Code>&lt;eventTimeStamp&gt; 2006-04-06T08:34:52Z &lt;/eventTimeStamp&gt;</Code>
		</Paragraph>
	</GeneralSection>
	<GeneralSection><SectionTitle>Sales order entry with EDI</SectionTitle>
		<ExampleSection><SectionTitle>
                                 Example 1: Create event (relevant)</SectionTitle>
			<Paragraph class="Default">The Exchange scheme produces the following event:</Paragraph>
			<CodeBlock space-and-orientation="indented-estimated">&lt;EventMessage&gt;
        &lt;ControlArea&gt;
            &lt;eventEntity&gt; tdsls400 &lt;/eventEntity&gt;
            &lt;eventAction&gt; create &lt;/eventAction&gt;
        &lt;/ControlArea&gt;
        &lt;DataArea&gt;
            &lt;tdsls400 actionType=create&gt;
                &lt;orno&gt; 1234 &lt;/orno&gt;
                &lt;ofbp&gt; SMITH &lt;/ofbp&gt;
                &lt;sotp&gt; A1 &lt;/sotp&gt;
                &lt;corg&gt; 3 &lt;/corg&gt;
            &lt;/tdsls400&gt;
        &lt;/DataArea&gt;
&lt;/EventMessage&gt;
</CodeBlock>
			<Paragraph class="Default">After you process this information in the transformation script, the output is as follows:</Paragraph>
			<CodeBlock space-and-orientation="indented-estimated">&lt;EventMessage&gt;
        &lt;ControlArea&gt;
            &lt;eventEntity&gt; SalesOrder &lt;/eventEntity&gt;
            &lt;eventAction&gt; newEDIOrder &lt;/eventAction&gt;
        &lt;/ControlArea&gt;
        &lt;DataArea&gt;
            &lt;SalesOrder actionType=create&gt;
                &lt;orderNumber&gt; 1234 &lt;/orderNumber&gt;
                &lt;customerID&gt; SMITH &lt;/customerID&gt;
                &lt;orderType&gt; A1 &lt;/orderType&gt;
            &lt;/SalesOrder&gt;
        &lt;/DataArea&gt;
&lt;/EventMessage&gt;</CodeBlock>
			<Paragraph class="Default">If you use an alternative transformation script that rebuilds the event, the output can be, for example, as follows:</Paragraph>
			<CodeBlock space-and-orientation="indented-estimated">&lt;WorkflowEvent&gt;
        &lt;eventType&gt; newEDIOrder &lt;/eventType&gt;
        &lt;UDAs&gt;
            &lt;orderNumber&gt; 1234 &lt;/orderNumber&gt;
            &lt;customerID&gt; SMITH &lt;/customerID&gt;
            &lt;orderType&gt; A1 &lt;/orderType&gt;
        &lt;/UDAs&gt;
&lt;/WorkflowEvent&gt;
</CodeBlock>
		</ExampleSection>
		<ExampleSection><SectionTitle>
                                 Example 2: create event (irrelevant)</SectionTitle>
			<Paragraph class="Default">The Exchange scheme produces following event:</Paragraph>
			<CodeBlock space-and-orientation="indented-estimated">&lt;EventMessage&gt;
        &lt;ControlArea&gt;
            &lt;eventEntity&gt; tdsls400 &lt;/eventEntity&gt;
            &lt;eventAction&gt; create &lt;/eventAction&gt;
        &lt;/ControlArea&gt;
        &lt;DataArea&gt;
            &lt;tdsls400 actionType=change&gt;
                &lt;orno&gt; 2345 &lt;/orno&gt;
                &lt;ofbp&gt; SMITH &lt;/ofbp&gt;
                &lt;sotp&gt; A2 &lt;/sotp&gt;
                &lt;corg&gt; 1 &lt;/corg&gt;
            &lt;/tdsls400&gt;
        &lt;/DataArea&gt;
&lt;/EventMessage&gt;
</CodeBlock>
			<Paragraph class="Default">The condition rejects this event.</Paragraph>
		</ExampleSection>
		<ExampleSection><SectionTitle>
                                 Example 3: Delete event (irrelevant)</SectionTitle>
			<Paragraph class="Default">The Exchange scheme produces the following event:</Paragraph>
			<CodeBlock space-and-orientation="indented-estimated">&lt;EventMessage&gt;
        &lt;ControlArea&gt;
            &lt;eventEntity&gt; tdsls400 &lt;/eventEntity&gt;
            &lt;eventAction&gt; delete &lt;/eventAction&gt;
        &lt;/ControlArea&gt;
        &lt;DataArea&gt;
            &lt;tdsls400 actionType=delete&gt;
                &lt;orno&gt; 1234 &lt;/orno&gt;
                &lt;ofbp&gt; SMITH &lt;/ofbp&gt;
                &lt;sotp&gt; A2 &lt;/sotp&gt;
                &lt;corg&gt; 3 &lt;/corg&gt;
            &lt;/tdsls400&gt;
        &lt;/DataArea&gt;
&lt;/EventMessage&gt;
</CodeBlock>
			<Paragraph class="Default">The condition rejects this event.</Paragraph>
		</ExampleSection>
	</GeneralSection>
	<GeneralSection><SectionTitle>Inventory on hand</SectionTitle>
		<ExampleSection><SectionTitle>
                                 Example: Change event (relevant)</SectionTitle>
			<Paragraph class="Default">The Exchange scheme produces the following event:</Paragraph>
			<CodeBlock space-and-orientation="indented-estimated">&lt;EventMessage&gt;
        &lt;ControlArea&gt;
            &lt;eventEntity&gt; whwmd215 &lt;/eventEntity&gt;
            &lt;eventAction&gt; change &lt;/eventAction&gt;
        &lt;/ControlArea&gt;
        &lt;DataArea&gt;
            &lt;whwmd215 actionType=change&gt;
                &lt;PreviousValues&gt;
                    &lt;cwar&gt; W01 &lt;/cwar&gt;
                    &lt;item&gt; BIKE001 &lt;/item&gt;
                    &lt;stoc&gt; 28 &lt;/stoc&gt;
                &lt;/PreviousValues&gt;
                &lt;cwar&gt; W01 &lt;/cwar&gt;
                &lt;item&gt; BIKE001 &lt;/item&gt;
                &lt;stoc&gt; 13 &lt;/stoc&gt;
            &lt;/tdsls400&gt;
        &lt;/DataArea&gt;
&lt;/EventMessage&gt;
</CodeBlock>
			<Paragraph class="Default">After you process this in the transformation script, the output is as follows:</Paragraph>
			<CodeBlock space-and-orientation="indented-estimated">&lt;EventMessage&gt;
        &lt;ControlArea&gt;
            &lt;eventEntity&gt; Inventory &lt;/eventEntity&gt;
            &lt;eventAction&gt; lowInventory &lt;/eventAction&gt;
        &lt;/ControlArea&gt;
        &lt;DataArea&gt;
            &lt;Inventory actionType=change&gt;
                &lt;warehouse&gt; W01 &lt;/warehouse&gt;
                &lt;item&gt; BIKE001 &lt;/item&gt;
                &lt;inventoryOnHand&gt; 13 &lt;/inventoryOnHand&gt;
                &lt;inventoryAllocated&gt; 50 &lt;/inventoryAllocated&gt;
                &lt;previousValuewarehouse&gt; W01 &lt;/previousValuewarehouse&gt;
                &lt;previousValueitem&gt; BIKE001 &lt;/previousValueitem&gt;
                &lt;previousValueinventoryOnHand&gt; 28 
                &lt;/previousValueinventoryOnHand&gt;
            &lt;/Inventory&gt;
        &lt;/DataArea&gt;
&lt;/EventMessage&gt;
</CodeBlock>
			<Paragraph class="Default">If you use an alternative transformation script that rebuilds the event, the output can be, for example, as follows:</Paragraph>
			<CodeBlock space-and-orientation="indented-estimated">&lt;WorkflowEvent&gt;
        &lt;eventType&gt; lowInventory &lt;/eventType&gt;
        &lt;UDAs&gt;
                &lt;warehouse&gt; W01 &lt;/warehouse&gt;
                &lt;item&gt; BIKE001 &lt;/item&gt;
                &lt;inventoryOnHand&gt; 13 &lt;/inventoryOnHand&gt;
                &lt;previousValueInventoryOnHand&gt; 28 
                &lt;/previousValueInventoryOnHand&gt;
        &lt;/UDAs&gt;
&lt;/WorkflowEvent&gt;
</CodeBlock>
		</ExampleSection>
	</GeneralSection>
	<GeneralSection><SectionTitle>Credit limit check from application</SectionTitle>
		<Paragraph class="Default">The application customization produces the following event:</Paragraph>
		<CodeBlock space-and-orientation="indented-estimated">&lt;EventMessage&gt;
    &lt;ControlArea&gt;
        &lt;eventEntity&gt; Customer &lt;/eventEntity&gt;
        &lt;eventAction&gt; creditLimitIsNear &lt;/eventAction&gt;
    &lt;/ControlArea&gt;
    &lt;DataArea&gt;
        &lt;Customer&gt;
            &lt;PreviousValues&gt;
                &lt;creditInUse&gt; 78000.00 &lt;/creditInUse&gt;
            &lt;/PreviousValues&gt;
            &lt;customerID&gt; SMITH &lt;/customerID&gt;
            &lt;orderNumer&gt; 4567 &lt;/orderNumer&gt;
            &lt;creditLimit&gt; 100000.00 &lt;/creditLimit&gt;
            &lt;creditInUse&gt; 83000.00 &lt;/creditInUse&gt;
        &lt;/Customer&gt;
    &lt;/DataArea&gt;
&lt;/EventMessage&gt;
</CodeBlock>
		<Paragraph class="Default">In this case, no transformation is required.</Paragraph>
		<Paragraph class="Default">If you use an alternative transformation script that rebuilds the event, the output can be, for example, as follows:</Paragraph>
		<CodeBlock space-and-orientation="indented-estimated">&lt;WorkflowEvent&gt;
        &lt;eventType&gt; creditLimitIsNear &lt;/eventType&gt;
        &lt;UDAs&gt;
            &lt;customerID&gt; SMITH &lt;/customerID&gt;
            &lt;orderNumer&gt; 4567 &lt;/orderNumer&gt;
            &lt;creditLimit&gt; 100000.00 &lt;/creditLimit&gt;
            &lt;creditInUse&gt; 83000.00 &lt;/creditInUse&gt;
        &lt;/UDAs&gt;
&lt;/WorkflowEvent&gt;
</CodeBlock>
	</GeneralSection>
</ManualTopic>
