The com.idsscheer.ppm.xmlextractortools.
extractor.sap2ppm.ZSortWithInteger_sap2ppm Java class to be used extracts data records from tables, sorts them using the specified sorting criteria, and writes either the first or last data record to the system events to be generated. The class must be specified in the classtouse attribute of the table XML element.
Example
Status history documents represent a special document type in the SAP R/3 system. These documents are stored in the JCDS table. The class is to determine the last change relating to a particular status type and to write this change to the corresponding system events. To do this, all order numbers are extracted from the AUFK table. In addition, for each order number with status information, all entries for that order number with the OR prefix and the status I0043 (STAT field) are extracted from the JCDS table. These are to be sorted by creation time (UDATE, UTIME) and the last data record created is to be extracted. All field values pertaining to this data record are to be written to the relevant system event.
The file extract below illustrates the configuration for extracting status information from the JCDS table under the above conditions:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE xmlextractor_tableconfiguration SYSTEM
'xmlextractor_tableconfiguration.dtd'>
<xmlextractor_tableconfiguration>
<configuration name="AUFK_JCDS">
<docspec>
<doctable name="AUFK">
<pkfield name="AUFNR"/>
</doctable>
</docspec>
<table name="JCDS_I0043" tablename="JCDS"
classtouse="com.idsscheer.ppm.
xmlextractortools.extractor.
sap2ppm.ZSortWithInteger_sap2ppm">
<parameter name="SORTCRITERION">
<value>UDATE</value>
<value>UTIME</value>
</parameter>
<parameter name="USE">
<value>MAX</value>
</parameter>
<condition fieldname="STAT"
logicaloperator="eq">
<value>I0043</value>
</condition>
<pkfield name="OBJNR" fktablename="AUFK"
fkfieldname="AUFNR">
<prefix>
<value>OR</value>
</prefix>
</pkfield>
<fieldtoread name="CDTCODE"/>
<fieldtoread name="CHGNR"/>
<fieldtoread name="CHIND"/>
<fieldtoread name="INACT"/>
<fieldtoread name="OBJNR"/>
<fieldtoread name="STAT"/>
<fieldtoread name="TCODE"/>
<fieldtoread name="USNAM"/>
</table>
</configuration>
</xmlextractor_tableconfiguration>
A system event extracted with this configuration could look like this:
<event>
<attribute type="AUFK-AUFNR">000000800002</attribute>
<attribute type="JCDS_I0043-CDTCODE"></attribute>
<attribute type="JCDS_I0043-CHGNR">002</attribute>
<attribute type="JCDS_I0043-CHIND">U</attribute>
<attribute type="JCDS_I0043-INACT">X</attribute>
<attribute type="JCDS_I0043-OBJNR">
OR000000800002
</attribute>
<attribute type="JCDS_I0043-STAT">I0043</attribute>
<attribute type="JCDS_I0043-TCODE">KOK2</attribute>
<attribute type="JCDS_I0043-UDATE">19961217</attribute>
<attribute type="JCDS_I0043-USNAM">MUELLERJ</attribute>
<attribute type="JCDS_I0043-UTIME">192122</attribute>
</event>
The sorting criteria (in this case UDATE, UTIME) are automatically included in the system event specification.
The template for creating the configuration shown looks like this (the XML elements and attributes that are optional is outlined in the table below):
<table name="..." tablename="..." classtouse=
"com.idsscheer.ppm.
xmlextractortools.extractor.
sap2ppm.ZSortWithInteger_sap2ppm">
<parameter name="SORTCRITERION">
<value>...</value>
<value>...</value>
...
</parameter>
<parameter name="USE">
<value>...</value>
</parameter>
...
See chapter
R3 table configuration (system event specification)
...
</table>
The table below reiterates the most important configuration entries for the above table definition:
XML element/attribute |
Value: Description |
---|---|
name |
The specified name is added to the extracted source system attributes as a prefix |
tablename |
Table from which the information is to be extracted. Default value: Value from name XML attribute |
classtouse |
com.idsscheer.ppm.xmlextractortools. Java class to be used |
parameter name |
|
SORTCRITERION |
First parameter to be specified. At least one value XML element must be specified (field name of sorting criterion). The specified fields may only contain integer values. If several sorting criteria are specified, they are prioritized from top to bottom, i.e., the data records are first compared against the first (top) criterion and then against the second criterion if no complete sorting has been created, and so on. |
USE |
Second parameter to be specified. A single value XML element must be specified. Valid values: Either the first or last data record from the list generated based on the specified sorting criteria is selected to be extracted. |
You should use this class for extracting the first or last line of a sorting sparingly, as the sorting and selection operations result in a loss of performance and memory.