Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

The mapping helps to distinguish the differences between two report outputs caused by report layout changes on different releases. Technically it translates corresponding report output (before or after image) to be in the same layout (e.g. column orders, headers differences, split lines, description differences) before comparing of lines starts. With the mapping is possible to define also lines that should be ignored in the process of comparison (e.g. split lines, headers, date, and times).

Following comparators support mapping applying:

  • Advanced Report Comparator,

  • Report Comparator with Threshold

  • Default BAdI Report Comparator

  • Python Report Comparator

All comparators are applying the mapping on the report output in the same way by the same rules.

Mapping editor

The creation, deletion, update, or display of mapping can be done in two ways:

  1. Directly via Validate report test variant - type a name of the mapping (use F4 search help to display existing mapping) in the report test variant and double click on the name. A new popup window with the mapping editor will be displayed.

  2. Call transaction /DVD/VAL_REP_MAP - chose a mapping on the selection screen (use F4 search help to display existing mapping) and execute. The mapping editor will be displayed.

The name of mapping can be up to 30 characters long and should start with the letter 'Z' (otherwise is not guaranteed that mapping will not be overwritten with the importing new Validate version).

To delete the mapping is enough to delete the content of the mapping in the editor.

The mapping with the name ‘VALIDATE_PREDEF_MAP’ is the default predefined mapping distributed with validate. It is used when the checkbox 'Use Predefined Mapping' is marked in Validate report test variant. The mapping can be displayed in the mapping editor but it is not recommended to change it! For your own mapping rules create a copy of the predefined mapping.

The mapping editor is an ALV table with a toolbar.

Except for standard ALV buttons for working with ALV (add/copy/paste/cut/delete line(s), sort lines, filter lines, etc.) some special buttons are on the toolbar. They have the following functions:

  • Display / Change - switch between edit and display mode. If the mapping editor is in edit mode then the displayed mapping is locked by the user who is editing. Another user may only display such mapping.

  • Check (only in edit mode) - perform some check for correctness on entered mapping. It will remove empty lines and sort the mapping based on the current line position. The check is always performed before each save to DB and before exporting to the CSV file. If some errors are found in the mapping then the mapping is not saved/exported and a popup with the error findings is displayed.

  • Export - will export the mapping to CSV file on local PC. After pressing the button popup will be displayed for entering the path and filename. The CSV file will contain all columns from the editor.

  • Import (only in edit mode) - will import CSV file from local PC to the mapping editor. After pressing the button popup will be displayed for choosing the file. The CSV file has to contain a header line with at least one technical name of the column from the editor. If the mapping editor contains already some mapping a question popup is displayed asking if you want to overwrite the mapping in the editor or you want to append imported mapping to it.

The mapping editor’s ALV table has the following columns [ with a technical name (with max. length ) ]:

  • Mapping ID [MAP_ID(integer)] - unique key of each mapping statement. The Mapping ID also represents an order of applying the mapping on the report output. It is automatically re-created after each check concerning the line order created by the user.

  • Report Name [REPORTNM(40)] - used to set dependency of mapping statement on the report name. If it is empty then the mapping statement can be applied to any report output.

  • Image Type [IMG_TYPE(1)] - used to set dependency of mapping statement on image type. If it is empty then the mapping statement is applied to the before and after image.

  • Mapping Function [MAP_FUNC(10)] - name of mapping specific function which will be applied on each line of report output. The applying depends also on function parameters in the mapping statement

  • 1st Parameter of Mapping Function [FUNC_PARAM1(string)] - meaning of the first parameter is function-specific

  • 2nd Parameter of Mapping Function [FUNC_PARAM2(string)] - meaning of the second parameter is function-specific

Non-editable columns:

  • Changed At [CHANGED_AT(timestamp)] - contains the date and time when the mapping statement was changed

  • Changed By User [CHANGED_BY(12)] - contains user name who changed mapping statement

  • Created At [CREATED_AT(timestamp)] - contains the date and time when the mapping statement was created

  • Created By User [CREATED_BY(12)] - contains user name who created mapping statement

Hidden columns (displayed via changing ALV layout):

  • Report Test Variant ID [VARIANT_ID(13)] - used to set dependency of mapping statement on Validate report test variant ID.

  • Report Test Run ID [RUNID(10)] - used to set dependency of mapping statement on Validate test Run ID.

  • Test Plan Technical Name [PL_TECHNAME(20)] - used to set dependency of mapping statement on Validate test plan name.

  • Report Test Case Technical Name [TC_TECHNAME(20)] - used to set dependency of mapping statement on Validate test case name.

Reserved columns (internal usage):

  • Software Component [COMPONENT(30)] - used to set dependency of mapping statement on SAP software component. The mapping statement is only applied if a software component exists on the system.

  • Software Component Release [COMP_RELEASE(10)] - used to set dependency of mapping statement on SAP software component release. The mapping statement is only applied if a software component exists on the system in this release. If the value in the software component is not set then this dependency is ignored.

  • Software Component Support Package Level [COMP_SP_LEVEL(4)] - used to set dependency of mapping statement on SAP software component SP level. The mapping statement is only applied if a software component exists on the system with this SP level. If the value in the software component is not set then this dependency is ignored.

ALV fields in column 1st Parameter of Mapping Function and 2nd Parameter of Mapping Function are editable up to 128 characters. To edit longer parameters always uses a popup for editing parameters by double click on the corresponding parameter field in the ALV. After closing the popup the parameter field in ALV internal table s updated with a new longer value.

Dependency of the mapping statements

The mapping statements can be created generically for all comparisons (all the dependency fields are blank) or comparison specific for a defined report, variant, test run, test case, or test plan.

The comparison of the reports is applying the comparison specific mapping statements concerning the following priority order:

  1. Variant ID

  2. Run ID

  3. Test plan name

  4. Test case name

  5. Report name

  6. Software component

  7. Component release

  8. Component SP level

Only one combination of the comparison-specific field values is applied during the comparison with the respect of the priority order with the following meaning: a combination of non-empty fields with higher priority determines the dependency.

Example:

Let’s assume a comparison of variant ID NSD0000006035, in test plan TP1, in test case TC1, for report RM07MTRB.

All following mapping statements may be applied in the comparison, but only statements with test plan value TP1 will be used.

It is because the test plan name in the combination “variant ID + test plan name + report name” has higher priority than the more general test case name in the combination “variant ID + test case name + report name“.

All mapping statements are automatically sorted and grouped by image type with respecting line position.

Mapping functions

The goal of the mapping functions is to make an automated comparison of the same report with a different layout or description easier. A mapping function defines a logic in which line in the report output will be processed and how it will be modified. Based on the value in the field “Image type”  (Relevant Image Type or IMG), the mapping function can be applied on:

  • Before image: value “B”

  • After image: value “A”

  • Both images: value “ “ (space)

Each mapping function is always processed on all report output lines before the next mapping function. The order of applying mapping functions is defined by mapping ID.

More mapping functions can be applied on the same line.

Following mapping functions are currently supported:

1. IGNO_EXACT - Ignore the line if it contains the same string as defined in the first parameter. Second parameter has to be empty!

2. IGNO_SUBST - Ignore the line if it contains a substring defined in the first parameter. Second parameter has to be empty!

3. IGNO_PATRN - Ignore the line if it matches a pattern defined in the first parameter. Second parameter has to be empty!

4. REPL_SUBST - Replace all substrings in the line. The substring which is searching is defined in the first parameter. In the second parameter is a defined string that will be used as a replacement.

5. REPL_WMASK - Replace characters with the mask. This function searches for a pattern defined in the first parameter. If a line matches the pattern then the function applies the mask (2nd parameter) on it.

6. REPL_REGEX - Replace all regex findings in the line. This function search for regex defined in the first parameter. If a regex match is found then is replaced with a string defined in the second parameter.

7. REPL_COLUM - Replace column order or add/delete column. This function search for pattern defined in the first parameter. If the line matched the pattern then the function applies column order change on the line. The second parameter contains the column order.

8. CNCT_PATRN - Concatenate line to the following line with another pattern. This function search for pattern defined in the first parameter. If the line matched the pattern then function search for the second pattern in the next line. The second pattern is defined in the second parameter. If also the second line matched the pattern then the function applies two-line concatenation.

Each mapping function may have up to two parameters. The purpose of the parameter depends on a specific mapping function. In general, the parameter can have one of the meanings explained in the next parts.

Search for the substring (functions IGNO_SUBSTR or REPL_SUBSTR)

The functions search for lines that contain a substring set in the 1st parameter.

Example:

Original lines
-------------------------------------------------------------------------------------------------
|Article            Article Description                      Site Name 1                        |
|SLoc MvT S Art. Doc.  Item Pstng Date   Quantity in UnE EUn   Ext. Amount LC Crcy              |
|-----------------------------------------------------------------------------------------------|

Defined substring for replacement
PARAM1: Article     -> PARAM2: Material
PARAM1: Description -> PARAM2: description
PARAM1: Site        -> PARAM2: Plnt
PARAM1: Art.        -> PARAM2: Mat.

Result after replacement
-------------------------------------------------------------------------------------------------
|Material           Material description                     Plnt Name 1                        |
|SLoc MvT S Mat. Doc.  Item Pstng Date   Quantity in UnE EUn   Ext. Amount LC Crcy              |
|-----------------------------------------------------------------------------------------------|

Search for pattern

Some of the mapping functions allow you to use patterns in the 1st parameter to search for relevant lines. The Validate search engine supports the following wildcards characters for the pattern definition:

  • ‘*' represents any character string

  • ‘+’ represents any character

  • ‘!’ represents any alphanumerical character

  • ‘#’ is the escape symbol for the wildcard characters

Upper/lower case is not taken into account.

Examples:

Original line:
Blava       Ledger 01       RFBILA00/UNAME    Page          10

Define matching pattern 
*/* Page *

(it finds all lines with "/" sign before a word " page " or " Page ")

Search for regex

The function with this parameter definition searches for a line which is matching the regex pattern from the parameter. Extended regular expressions can be used by POSIX standard 1003.2. The regex pattern can be tested in the ABAP program DEMO_REGEX_TOY.

REPL_WMASK - Apply mask

The function REPL_WMASK identifies a line based on a pattern defined in parameter 1 and replaces the line by applying a character mask defined in parameter 2. The pattern in parameter 1 is defined the same way as described above (see section “Search for pattern” above). The mask is using two special characters:

  • “=” is a special character keeping the original character in its position.

  • “#” is the escape symbol for the special character. Using the “#=” will use “=” sign on the “#” position in the mask.

All other characters are used for replacing the characters in the output line on their position in the mask.

Upper/lower case is not taken into account.

Example 1:

Original lines
|Purch.Doc.  SPlt Item S          Quantity BUn  Amt.in Loc.Cur. Crcy     Order Quantity OUn  Net Order Value Crcy     |
|1234567890  DC01   12                 12  AB           123,45  ABC                  1  ABC          123,45  ABC      |

Parameter 1 (mask definition):
|+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++|

Parameter 2 (change logic - add splitter "|" after each column and change 3 chars as of 64th char to "CDE"):
|===========|====|====|=|========|========|====|===============|CDE=====|=====|========|====|===|===========|=========|

Result after applying the mask (the logic is applied on every line starting and ending with "|")
|Purch.Doc. |SPlt|Item|S|        |Quantity|BUn |Amt.in Loc.Cur.|CDEy    |Order|Quantity|OUn |Net|Order Value|Crcy     |
|1234567890 |DC01|  12| |        |     12 |AB  |        123,45 |CDE     |     |      1 |ABC |   |    123,45 |ABC      |

Example 2:

Original lines
|Purch.Doc.  SPlt Item S          Quantity BUn  Amt.in Loc.Cur. Crcy     Order Quantity OUn  Net Order Value Crcy     |
|1234567890  DC01   12                 12  AB           123,45  ABC                  1  ABC          123,45  ABC      |

Parameter 1 (mask definition):
|++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ABC++++++|

Parameter 2 (change logic - add splitter "|" after each column and change 3 chars as of 64th char to "CDE")
|===========|====|====|=|========|========|====|===============|CDE=====|=====|========|====|===|===========|=========|

Result after applying the mask (the logic is applied only for the lines where 3 chars after 10th char from right = ABC)
|Purch.Doc.  SPlt Item S          Quantity BUn  Amt.in Loc.Cur. Crcy     Order Quantity OUn  Net Order Value Crcy     |
|1234567890 |DC01|  12| |        |     12 |AB  |        123,45 |CDE     |     |      1 |ABC |   |    123,45 |ABC      |

Apply for column order

The function of this application changes the order of columns in the processed line. First, the line is split by the character ‘|' into columns. The original order of columns is marked from 1 to the last column. Then the function creates new line output as a concatenation of columns with column order based on column indexes definition in the parameter of the function. All indexes in the definition have to be split by the character ‘|’. The first and last character in the definition has to be also character ‘|’. The maximum index of columns used in the definition has not exceeded the real number of columns. The minimum index of columns is 1. The same index can be repeated more than once. No index between two pipes (like ‘| |’) will create an empty column. The concatenated columns are separated with ‘|’. The first and last character in the result of the concatenation is also '|’. Columns are concatenated concerning spaces.

Allowed column orders in the definition for a line with 5 columns
 |1|2|3|4|5| - simple one
 |4|5|3|1|2| - changed order
 | 1  |3   |2|   4| 5 | - spaces are allowed
 |1|1|1|1|5|3|2| - multiple replications of the same column, more columns in the result
 |4| - at least one column in the result
 |1|| |4|5| - empty columns
 ||||||||||| |1|| | - empty columns, more columns in result

Not allowed column orders in the definition for the line with 5 columns
1|2|3|4|5| - missing pipe at the beginning of columns
|1|2|3|4|5 - missing pipe at the ending of column
|1|2 3|4|5 - missing pipe/not a number
|1|2|3|4|6| - max. index of the column is exceeded
|abc|2|3|4 3|5| - not a number/string used in the mask

Example:

Original line:
|Settl Doc.|Doc. List|Doc. Type|SDocType Text     |SProc Type|SProc Typ   |Post.Date |POrg|PGr|SOrg.|

Defined column order: 
|2|1| |3|3|10|

Result line:
|Doc. List|Settl Doc.||Doc. Type|Doc. Type|SOrg.|

Apply two lines of concatenation

The function with this application will join two consecutive lines. The result is concatenated to the first line and the second line is deleted.

Example:

Original lines
------------------------------------------------------------------------------------
|SOrg. DChnl Site PL RefPl Article            Un  GTIN                             |
|Ty. ID     Message                                                                |
|----------------------------------------------------------------------------------|
|S153  AB                  1234567            AB  1234567890123                    |
|    WV335  No conditions could be found for the item displayed                    |

Defined pattern for lines to be concatenated
|!!!!+ !!+++ ++++ ++ +++++ !!!!!!!+++++++++++|!!+ !!!!+++++++++++++++++++++++++++++|
|+++ !!++++ !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++|

Result after concatenation
------------------------------------------------------------------------------------
|SOrg. DChnl Site PL RefPl Article            Un  GTIN                             ||Ty. ID     Message                                                                |
|----------------------------------------------------------------------------------|
|S153  AB                  1234567            AB  1234567890123                    ||    WV335  No conditions could be found for the item displayed                    |

Mapping log

The number of mapping functions applied is documented for each comparison within the comparison log.

Testing of mapping

Transaction /DVD/VAL_REP_MTEST was created for testing custom-specific mapping. On the selection screen of the transaction is possible to define a specific run, variant, or line for which the mapping should be tested. The parameter option ‘Apply predefined mapping first’ will apply default mapping before custom mapping will be applied. A parameter “Apply final row normalization” will apply final correction on each line and display the line in the internal normalized form which is used for final comparing.

The execution of the transaction doesn't do any change on DB, it only writes an output with detailed information if and how the mapping was applied.

  • No labels