The illustration below shows an example data model of a data extraction.
You need to define a table for which a PPM system event is to be generated for each data row read. In our example, a PPM system event is to be generated for each sales document item created or modified in January 2006 and contained in the VBAP SAP table. In addition, for each sales document item, the corresponding rows and fields from the other tables are to be extracted. The associated configuration in CTK or XML looks like this:
<docspec>
<doctable name="VBAP">
<booleancondition logicaloperator="OR">
<condition logicaloperator="creationtimestamp"
fieldname="ERDAT">
<value>yyyyMMdd</value>
</condition>
<condition logicaloperator="creationtimestamp"
fieldname="AEDAT">
<value>yyyyMMdd</value>
</condition>
</booleancondition>
<pkfield name="VBELN" />
<pkfield name="POSNR" />
</doctable>
</docspec>
<table name="VBAP">
<pkfield name="VBELN" fktablename="VBAP"
fkfieldname="VBELN"/>
<pkfield name="POSNR" fktablename="VBAP"
fkfieldname="POSNR"/>
<fieldtoread name="ERDAT"/>
<fieldtoread name="ERZET"/>
<fieldtoread name="ERNAM"/>
<fieldtoread name="AEDAT"/>
<fieldtoread name="MATNR">
<textref tablename="MAKT" reffieldname="MATNR"
textfieldname="MAKTX" langfieldname="SPRAS"/>
</fieldtoread>
<fieldtoread name="PRODH">
<textref tablename="T179T" reffieldname="PRODH"
textfieldname="VTEXT" langfieldname="SPRAS"/>
</fieldtoread>
</table>
<table name="VBAK">
<pkfield name="VBELN" fktablename="VBAP"
fkfieldname="VBELN"/>
<fieldtoread name="VKORG"/>
<fieldtoread name="VBTYP"/>
<fieldtoread name="BSTDK"/>
<fieldtoread name="ERNAM"/>
<fieldtoread name="ERDAT"/>
<fieldtoread name="ERZET"/>
</table>
<table name="MARA">
<pkfield name="MATNR" fktablename="VBAP"
fkfieldname="MATNR"/>
<fieldtoread name="MTART">
<textref tablename="T134T" reffieldname="MTART"
textfieldname="MTBEZ" langfieldname="SPRAS"/>
</fieldtoread>
</table>
The first query generated by PPM Process Extractor SAP-2-PPM and executed in the SAP system looks like this:
SELECT vbeln, posnr FROM vbap WHERE (erdat >= 20060101 AND erdat <= 20060131) OR (aedat >= 20060101 AND aedat <= 20060131)
As the VBAP table is normally very large, we recommend that you create the following two database indices to prevent a full table scan of the database and thus speed up the extraction process:
Once the key fields of the source system event have been extracted from the VBAP table, the other fields are extracted from the VBAP table or the other tables and added to the source system event. In our example, data is extracted from these tables using simple foreign key relationships. The corresponding query, e.g., executed to extract the fields from the VBAK table, looks like this:
SELECT vbeln, vkorg, vbtyp, bstdk, ernam, erdat, erzet FROM vbak WHERE vbeln in (…)
The source system event, which is extracted using the above event specification, can look like this:
<event>
<attribute type="MARA-MTART">HAWA</attribute>
<attribute type="MARA-MTART-MTBEZ">Trading goods
</attribute>
<attribute type="VBAK-BSTDK">19970306</attribute>
<attribute type="VBAK-ERDAT">19970306</attribute>
<attribute type="VBAK-ERNAM">BOLLINGER</attribute>
<attribute type="VBAK-ERZET">091423</attribute>
<attribute type="VBAK-VGTYP"></attribute>
<attribute type="VBAK-VKORG">1000</attribute>
<attribute type="VBAP-AEDAT">20020117</attribute>
<attribute type="VBAP-ERDAT">19970306</attribute>
<attribute type="VBAP-ERNAM">BOLLINGER</attribute>
<attribute type="VBAP-ERZET">091423</attribute>
<attribute type="VBAP-MATNR">DPC1009</attribute>
<attribute type="VBAP-MATNR-MAKTX">
Standard Keyboard - EURO Model
</attribute>
<attribute type="VBAP-POSNR">000020</attribute>
<attribute type="VBAP-PRODH">001250010000000135</attribute>
<attribute type="VBAP-VBELN">0000005056</attribute>
</event>