| # XML used at runtime Introduction 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. 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. 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. Optionally, the user can add an event time to the control area, such as: `<eventTimeStamp> 2006-04-06T08:34:52Z </eventTimeStamp>` Sales order entry with EDI Example 1: Create event (relevant) The Exchange scheme produces the following event:
    <EventMessage>
            <ControlArea>
                <eventEntity> tdsls400 </eventEntity>
                <eventAction> create </eventAction>
            </ControlArea>
            <DataArea>
                <tdsls400 actionType=create>
                    <orno> 1234 </orno>
                    <ofbp> SMITH </ofbp>
                    <sotp> A1 </sotp>
                    <corg> 3 </corg>
                </tdsls400>
            </DataArea>
    </EventMessage>
After you process this information in the transformation script, the output is as follows:
    <EventMessage>
            <ControlArea>
                <eventEntity> SalesOrder </eventEntity>
                <eventAction> newEDIOrder </eventAction>
            </ControlArea>
            <DataArea>
                <SalesOrder actionType=create>
                    <orderNumber> 1234 </orderNumber>
                    <customerID> SMITH </customerID>
                    <orderType> A1 </orderType>
                </SalesOrder>
            </DataArea>
    </EventMessage>
If you use an alternative transformation script that rebuilds the event, the output can be, for example, as follows:
    <WorkflowEvent>
            <eventType> newEDIOrder </eventType>
            <UDAs>
                <orderNumber> 1234 </orderNumber>
                <customerID> SMITH </customerID>
                <orderType> A1 </orderType>
            </UDAs>
    </WorkflowEvent>
Example 2: create event (irrelevant) The Exchange scheme produces following event:
    <EventMessage>
            <ControlArea>
                <eventEntity> tdsls400 </eventEntity>
                <eventAction> create </eventAction>
            </ControlArea>
            <DataArea>
                <tdsls400 actionType=change>
                    <orno> 2345 </orno>
                    <ofbp> SMITH </ofbp>
                    <sotp> A2 </sotp>
                    <corg> 1 </corg>
                </tdsls400>
            </DataArea>
    </EventMessage>
The condition rejects this event. Example 3: Delete event (irrelevant) The Exchange scheme produces the following event:
    <EventMessage>
            <ControlArea>
                <eventEntity> tdsls400 </eventEntity>
                <eventAction> delete </eventAction>
            </ControlArea>
            <DataArea>
                <tdsls400 actionType=delete>
                    <orno> 1234 </orno>
                    <ofbp> SMITH </ofbp>
                    <sotp> A2 </sotp>
                    <corg> 3 </corg>
                </tdsls400>
            </DataArea>
    </EventMessage>
The condition rejects this event. Inventory on hand Example: Change event (relevant) The Exchange scheme produces the following event:
    <EventMessage>
            <ControlArea>
                <eventEntity> whwmd215 </eventEntity>
                <eventAction> change </eventAction>
            </ControlArea>
            <DataArea>
                <whwmd215 actionType=change>
                    <PreviousValues>
                        <cwar> W01 </cwar>
                        <item> BIKE001 </item>
                        <stoc> 28 </stoc>
                    </PreviousValues>
                    <cwar> W01 </cwar>
                    <item> BIKE001 </item>
                    <stoc> 13 </stoc>
                </tdsls400>
            </DataArea>
    </EventMessage>
After you process this in the transformation script, the output is as follows:
    <EventMessage>
            <ControlArea>
                <eventEntity> Inventory </eventEntity>
                <eventAction> lowInventory </eventAction>
            </ControlArea>
            <DataArea>
                <Inventory actionType=change>
                    <warehouse> W01 </warehouse>
                    <item> BIKE001 </item>
                    <inventoryOnHand> 13 </inventoryOnHand>
                    <inventoryAllocated> 50 </inventoryAllocated>
                    <previousValuewarehouse> W01 </previousValuewarehouse>
                    <previousValueitem> BIKE001 </previousValueitem>
                    <previousValueinventoryOnHand> 28
                    </previousValueinventoryOnHand>
                </Inventory>
            </DataArea>
    </EventMessage>
If you use an alternative transformation script that rebuilds the event, the output can be, for example, as follows:
    <WorkflowEvent>
            <eventType> lowInventory </eventType>
            <UDAs>
                    <warehouse> W01 </warehouse>
                    <item> BIKE001 </item>
                    <inventoryOnHand> 13 </inventoryOnHand>
                    <previousValueInventoryOnHand> 28
                    </previousValueInventoryOnHand>
            </UDAs>
    </WorkflowEvent>
Credit limit check from application The application customization produces the following event:
    <EventMessage>
        <ControlArea>
            <eventEntity> Customer </eventEntity>
            <eventAction> creditLimitIsNear </eventAction>
        </ControlArea>
        <DataArea>
            <Customer>
                <PreviousValues>
                    <creditInUse> 78000.00 </creditInUse>
                </PreviousValues>
                <customerID> SMITH </customerID>
                <orderNumer> 4567 </orderNumer>
                <creditLimit> 100000.00 </creditLimit>
                <creditInUse> 83000.00 </creditInUse>
            </Customer>
        </DataArea>
    </EventMessage>
In this case, no transformation is required. If you use an alternative transformation script that rebuilds the event, the output can be, for example, as follows:
    <WorkflowEvent>
            <eventType> creditLimitIsNear </eventType>
            <UDAs>
                <customerID> SMITH </customerID>
                <orderNumer> 4567 </orderNumer>
                <creditLimit> 100000.00 </creditLimit>
                <creditInUse> 83000.00 </creditInUse>
            </UDAs>
    </WorkflowEvent>