Attribute transformation

To change the values of particular attribute types in the output files or to create additional attribute types, you need to specify this in an XML configuration file. The name of this XML configuration file is transferred to the command line program as an argument.

This configuration file contains the settings for processing existing attribute types and for generating and transforming new attribute types when creating the XML output file(s).

The format of the XML file is specified by the following DTD:

s_csv_2_DTD_5

XML element or XML attribute

Description

attributecalculation

Configuration of attribute transformation

calculateattribute

Generation of a system event attribute type for successful execution of the transformation rule (operation)

type

Name of the system event attribute type generated

onfailure

Cancelation behavior if transformation fails. Valid values:
nolog (no log output)
info (output as information)
warn (output as warning)
error (output as error message)

Default value: info

operation

Transformation rule that is implemented by a Java class. Each operation has a single return value in the form of a string. If the operation fails, nothing is returned.

name

Name of operation

constant

Constant value to be used in the transformation

valueof

Value of an existing or already transformed source system attribute type

The calculateattribute elements are processed in the order in which they are specified in the configuration file. Nesting of the operation XML elements is processed outwards or from top to bottom.

For reasons of efficiency, during an attribute transformation only those arguments that are essential for the transformation are evaluated. For example, in the if_then_else operation, after the truth of the first argument is checked, only the second argument (then) or the third argument (else) is processed. The attribute transformation is canceled with an error message as soon as a required element cannot return a value.

If the onfailure XML element in the attribute transformation file has the value error, unsuccessful attribute generation results in the corresponding system event being assigned the EVENT_HAS_ATTRIBUTE_ERRORS=true attribute in the XML output file. In addition, an error message is generated in the log file.

If the onfailure XML attribute has the value warn, unsuccessful attribute generation results in the corresponding system event being assigned the EVENT_HAS_ATTRIBUTE_WARNINGS=true attribute in the XML output file. In addition, a warning is generated in the log file.

Warning

calculateattribute allows the values of existing attribute types to be overwritten after successful execution of the corresponding transformation rules (operation). No warning is output. If necessary, ensure that the values of existing attribute types are not accidentally overwritten by performing a conditional existence check with a suitable transformation rule. You can use the exists operation (see chapter Operations) for this purpose.

If the entire transformation for an attribute is canceled, the existing attribute value remains unchanged. Depending on what you have specified for the onfailure option, a corresponding message is output with a reference to the system event generated. For nolog, no log is output.

Example

The extraction of source system data from the R/3 system and the subsequent processing by the XML Generator have created the following entry in the event.xml XML output file:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE eventlist SYSTEM "event.dtd">

<eventlist>

<event>

<attribute type="VBAP-VBELN">3866</attribute>

<attribute type="VBAP-POSNR">20</attribute>

<attribute type="VBAP-ERNAM">SCHMIDT</attribute>

<attribute type="VBAP-MATNR-MAKTX">100038</attribute>

<attribute type="VBAP-KWMENG">3</attribute>

</event>

</eventlist>

Using the following specifications in the attributetransform.xml attribute transformation file, you can change the display of the values of the VBAP-ERNAM attribute type so that the concatenation of the original value with a constant string will be used as the new value.

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE attributecalculation SYSTEM

"attributetransformation.dtd">

<attributecalculation>

<calculateattribute type="VBAP-ERNAM">

<operation name="concat">

<constant>Walter, "A" </constant>

<valueof>VBAP-ERNAM</valueof>

</operation>

</calculateattribute>

...

</attributecalculation>

The following command line call creates the desired XML output file from the original XML output file using the attribute transformation file discussed above. 

runsap2ppm -systemconfig SysConfig.xml ides_doc_vdap -tableconfig TableConf.xml SD_C -begindate 01.01.2005 -enddate 31.01.2005 -calcconfig attributetransform.xml -outfile event -outfileencoding ISO-8859-1 -nozip

The same entry as the one above then looks like this:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE eventlist SYSTEM "event.dtd">

<eventlist>

<event>

<attribute type="VBAP-VBELN">3866</attribute>

<attribute type="VBAP-POSNR">20</attribute>

<attribute type="VBAP-ERNAM">Walter, "A" SCHMIDT

</attribute>

<attribute type="VBAP-MATNR-MAKTX">100038</attribute>

<attribute type="VBAP-KWMENG">3</attribute>

</event>

</eventlist>