Add up values of a field

Depending on the data type, you can add up the values of a field either as integers or decimals by specifying parameters in the relevant table element in the table configuration. A separate class must be used to do this.

Example

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

<!DOCTYPE xmlextractor_tableconfiguration SYSTEM

'xmlextractor_tableconfiguration.dtd'>

<xmlextractor_tableconfiguration>

<configuration name="SUM">

<docspec>

<docreftable name="...">

...

</docreftable>

<doctable name="...">

...

</doctable>

</docspec>

<table name="VBEP"

classtouse="com.idsscheer.ppm.xmlextractortools.

extractor.sap2ppm.ZNumberOperation_sap2ppm">

<parameter name="FIELDS">

<value>BMENG</value>

<value>WMENG</value>

</parameter>

<parameter name="OPERATION">

<value>SUM_DECIMAL</value>

</parameter>

<pkfield name="VBELN" fktablename="VBAP"

fkfieldname="VBELN"/>

<pkfield name="POSNR" fktablename="VBAP"

fkfieldname="POSNR"/>

</table>

</configuration>

</xmlextractor_tableconfiguration>

The example configuration specifies that for each of the floating point number fields BMENG and WMENG, the total of several values belonging to a sales document item (POSNR) in a sales document (VBELN) is calculated and written to a new system event attribute. The name of the new attribute is made up of <tablename>-<operator><fieldname>, e.g., VBEP-SUM_DECIMALWMENG. The com.idsscheer.ppm.xmlextractortools.extractor.sap2ppm.
ZNumberOperation_sap2ppm class is used for adding up field values.

The following item numbers exist in the SAP system for the sales document 5696:

VBELN

POSNR

WMENG

BMENG

5696

10

353,000

103,000

5696

10

215,000

52,000

5696

10

127,000

313,000

5696

20

89,000

79,000

5696

20

456,000

29,000

5696

30

23,000

269,000

5696

30

87,000

159,000

5696

30

124,000

256,000

5696

30

59,000

237,000

When extracting using the example configuration, for each item number the decimal sums are calculated for the BMENG and WMENG fields and the following system events are generated:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE eventlist SYSTEM "event.dtd">

<eventlist>

<event>

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

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

<attribute type="VBEP-SUM_DECIMALBMENG">468.000</attribute>

<attribute type="VBEP-SUM_DECIMALWMENG">695.000</attribute>

</event>

<event>

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

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

<attribute type="VBEP-SUM_DECIMALBMENG">108.000</attribute>

<attribute type="VBEP-SUM_DECIMALWMENG">545.000</attribute>

</event>

<event>

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

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

<attribute type="VBEP-SUM_DECIMALBMENG">921.000</attribute>

<attribute type="VBEP-SUM_DECIMALWMENG">293.000</attribute>

</event>

</eventlist>