Cross Database Comparison Enhancement Guide Document Version 1.0 (2014-07-15) w
Cross Database Comparison Enhancement Guide Document Version 1.0 (2014-07-15) www.sap.com TABLE OF CONTENT MOTIVATION .................................................................................................................................................... 3 Characteristics of generated CDC Data Extractors ..................................................................................... 3 Limitation of generated CDC Data Extractors .............................................................................................. 3 DATA EXTRACTORS FOR SOURCE TYPE ABAP ........................................................................................ 4 General Procedure to enhance the generated ABAP data extractor ......................................................... 4 Example case ................................................................................................................................................... 4 DATA EXTRACTORS FOR SOURCE TYPE ADBC ........................................................................................ 5 General Procedure to enhance the generated ADBC SQL statement ........................................................ 5 ENHANCEMENT SPOTS WITHIN CDC ........................................................................................................... 6 Enhancement Spot DSWP_CDC_CONVERSION .......................................................................................... 6 Procedure .......................................................................................................................................................... 6 Enhancement Spot DSWP_CDC_SOURCE ................................................................................................... 7 Filter possibilities for implementation ................................................................................................................. 8 Interface to be implemented .............................................................................................................................. 8 CREATING YOUR OWN SOURCE TYPES ..................................................................................................... 8 Procedure ......................................................................................................................................................... 8 Definition of the source type .............................................................................................................................. 8 Creation of the class ........................................................................................................................................ 11 Which methods have to be implemented? ...................................................................................................... 14 Embedding a specific UI for your source type ................................................................................................. 14 APPENDIX ...................................................................................................................................................... 16 Enhancing SQL extractions with DISTINCT ................................................................................................ 16 Business Example ........................................................................................................................................... 16 Enhancing SQL extractions with relative date selections ......................................................................... 16 Business Example ........................................................................................................................................... 16 MS-SQL server ................................................................................................................................................ 16 MaxDB ............................................................................................................................................................. 17 Enhanced ABAP data extractor with relative date selection on yesterday (simple date field) ............. 17 Enhanced ABAP data extractor with relative date selection on yesterday (timestamp field), independent SELECT... FOR ALL ENTRIES, additional application logic, key mapping ....................... 21 BAdI implementation for enhancement spot DSWP_CDC_SOURCE ....................................................... 28 Business Use Case ......................................................................................................................................... 28 Procedure ........................................................................................................................................................ 28 CROSS DATABASE COMPARISON – ENHANCEMENT GUIDE 3 MOTIVATION Characteristics of generated CDC Data Extractors With the Cross Database Comparison (CDC) tool, you define a graphical data model of both source systems and the mapping of the comparison fields between them. This data model offers a lot of flexibility, like joins on several tables and filters on fixed and dynamic criteria. Based on the data model, certain source types like ABAP and ADBC perform a generation, which is an automatic creation of the corresponding extractor ABAP function module or the native SQL statement. This generation happens based on fixed templates, to create the code to extract the data based on the object model, using best practices and common procedures to facilitate an “as-close-as-possible” match to the expected extraction scenario. Limitation of generated CDC Data Extractors However, there might be cases where the generated data extractor does not fully meet the requirement. Examples are: Instead of INNER JOINs you require other JOIN types Instead of JOINs, you rather require nested select loops, e.g. to have the possibility to insert additional logic between the selection of header and child tables You need to perform additional application logic, like special data conversion, key mapping, customizing lookup, extra filtering, and so on You require additional authorization checks CROSS DATABASE COMPARISON – ENHANCEMENT GUIDE 4 DATA EXTRACTORS FOR SOURCE TYPE ABAP General Procedure to enhance the generated ABAP data extractor Create the data model (the source tables do not really need to match the real situation, but the mapping must consist exactly of all required key and data fields). Generate the ABAP RFC extractor function module. Optionally copy it to some other name. Using ABAP Workbench, manually change and enhance the coding. o Usually you should only modify the middle part with the database selections. o Please note that there is one selection to get the expected number of records, SELECT COUNT(*)..., and another part for the actual data extraction, so make sure they follow the same logic to get the same result. o Do not touch the general framework and the XML transformation. o Do not remove the authorization checks. In the CDC comparison instance, make sure you enter the correct function module name. Example case The actual goal of the comparison is quite simple: Compare the delivery numbers of all deliveries created yesterday between SAP EWM and SAP ERP, which have a successful goods movement for all items, to prove whether it was correctly replicated from EWM to ERP. On the ERP side, the only enhancement is a relative date selection on all documents created yesterday, filtering on LIKP~ERDAT (simple date field). On the EWM side, there were multiple extensions necessary, caused by the completely different data model: - Relative date selection based on a timestamp field /SCDL/DB_PROCH_O~CRETST. - Requirement to read all item’s status from /SCDL/DB_STATUS, because there is no appropriate status field on header level, together with an aggregation of header status telling all items have goods issue finished. - Mapping of the EWM document ID to the corresponding ERP delivery number. Note: As of ST 7.1 SP5, the relative date filtering is available in standard. => See appendix for code samples CROSS DATABASE COMPARISON – ENHANCEMENT GUIDE 5 DATA EXTRACTORS FOR SOURCE TYPE ADBC General Procedure to enhance the generated ADBC SQL statement Create the data model (the source tables do not really need to match the real situation, but the mapping must consist exactly of all required key and data fields) Generate the native SQL counter and extractor statements Directly modify the SQL statement code on the CDC UI o To open the corresponding UI fields for input, you need to do a modification of the SAP- delivered source type for ADBC (or a copy of it in custom namespace), by following these steps: - Call transaction DSWP_CDC_SOURCES (“CDC: Customize Sources”). - Mark source type ADBC and select dialog structure “CDC Source Parameter”. - Switch to change mode. - See details for source type parameter SQL_COUNT (double-click). - Change “Param Usage in Obj.” from “Display only” to “Maintenance”. - Go back or press button “Next Entry”. - See details for source type parameter SQL_EXTR. - Change “Param Usage in Obj.” from “Display only” to “Maintenance”. - To save the changes you need a workbench request (cross-client customizing). o Make sure the selected fields in the SELECT-clause do really match the comparison object model as defined in the mapping information. The selected fields should exist as thy are used to build a target structure. o Changing the FROM-clause is typically harmless, as long as the correct data is extracted at the end. o When changing the WHERE-clause, make sure the selection filters correctly match to the other source system. o Make sure you have an ORDER-BY-clause to force a correct sort order of the comparison key(s), in case the comparison key(s) is different to the table’s primary key. Attention: When you re-generate, the modified SQL statement will be overwritten! => See appendix for code samples CROSS DATABASE COMPARISON – ENHANCEMENT GUIDE 6 ENHANCEMENT SPOTS WITHIN CDC The functionality of the CDC can be enhanced using two enhancement spots DSWP_CDC_CONVERSION This enhancement can be used to implement additional conversion IDs which can be entered in the mapping data and which can then be executed as part of the normal conversion based on conversion IDs. DSWP_CDC_SOURCE This enhancement can be used to modify the extracted data directly. Enhancement Spot DSWP_CDC_CONVERSION This enhancement spot can be used to modify method CONVERT_DATA of class CL_DSWP_CDC_CONVERSION. Method CONVERT_DATA is used to execute the different conversions based on Conversion ID as entered on the mapping detail screen. Procedure 1. Create a new conversion ID Start transaction SM30 and enter view CDC_V_CONV_TYPE. Click on “Maintain” (Figure 1) Figure 1 A maintenance dialog will be displayed. Click on “New entries” and enter the following data: a. Conversion ID The conversion ID is the technical name which will identify the conversion. It is character field with length 10. The name has to start with “Y” or “Z” for customer specific conversions. b. Field Label This is the text that will appear in the drop-down list when selecting a conversion ID in the mapping detail screen: CROSS DATABASE COMPARISON – ENHANCEMENT GUIDE 7 Figure 2 c. Description A more detailed description what this conversion will do. The description is just for internal reference but will currently not be displayed on any screen. 2. Implement the coding Start the class builder for class CL_DSWP_CDC_CONVERSION and navigate into method CONVERT_DATA. Click on button Enhance . Position the cursor on the line “ENHANCEMENT- POINT DSWP_CDC_CONV_ID SPOTS DSWP_CDC_CONVERSION . “ and perform a right click to display the context menu. Choose option Enhancement Operations → Create implementation. Enter a name for your enhancement in the displayed popup. Best practice would be to use the conversion ID is the conversion ID you have entered as technical name to have a simple reference between coding and definition. Add the following coding to the new enhancement implementation IF <fs_conversion>-conv_id EQ ‘<conversion_id>. <YOUR CONVERSION CODE> ENDIF. Here <conversion_id> should be the technical name of the conversion ID you have created, while <YOUR CONVERSION CODE> contains your actual code. You can use the standard conversion routines as guidance how your conversion coding could look like. Please implement SAP note 1942636 - CDC: Not possible to implement enhancements for data conversion if you have problems with the enhancement implementation. Enhancement Spot DSWP_CDC_SOURCE This enhancement spot uses BAdI DSWP_CDC_SOURCE_DATA and can be uploads/Finance/ cdc-enhancement-guide.pdf
Documents similaires










-
22
-
0
-
0
Licence et utilisation
Gratuit pour un usage personnel Attribution requise- Détails
- Publié le Jan 20, 2022
- Catégorie Business / Finance
- Langue French
- Taille du fichier 1.5319MB