Create Validation Tests

Parent Previous Next

Create Validation Tests


Usage of the Validation Engine


The Validation Engine is used both interactively and to produce detailed validation reports.





Displayed validation reports can be grouped, sorted, filtered, and saved as an Excel Workbook.



Getting Started


Let's walk through the process of creating validation tests for a mapping project. Your first project will take a while, but with a bit of experience -- and a kit of projects to copy/paste from -- you'll find that adding comprehensive validation to a mapping project takes less than an hour of effort.


For this discussion, we assume that you already did Create a Mapping Project or have opened an existing project with selected IDoc Segments and Fields.


On the Home ribbon, click the Validate button to make Validation active.  When the Validate mode is toggled active then the Bottom Grid displays the Validation Tests for a selected Field.



Initialize  - Create Basic Validation Tests


On the Home ribbon, on the Validate sub-menu, choose the menu item for Initialize.  This single click will create simple validation tests for every field in the mapping project. There are two tests created for each field. The first test is created based on the data type and length of the field. The second test checks for leading and trailing spaces, which are unlikely to be allowed in any field of any Load-ready file.



Validation Tests in the User Interface


When the Validate mode is toggled active on the Home ribbon tab, then the Bottom Grid displays the Validation Tests for a selected Field.



The above illustrates use of the ValueIsPattern test to require a value with 10 digits.


One or more Validation Tests can be created for each mapped field.   For each Validation Test, you must specify certain properties:


Property

Property Comments

Active

Only tests that are marked Active are executed.

Test

Choose a Test from the drop down lists.

Test Parameters

Some tests accept parameters.  These are inputs or options that may be supplied to a Test.


The definition and usage of all Tests, including use of Test Parameters, is found here: Validation Engine Tests


When more than one parameter is accepted to a test, then the parameters are separated by a vertical pipe character ( | ).

Test Failure Message

This is the message that will appear in a tool tip or report when the test fails.


The test failure message can be a simple text, such as:


Mandatory Entry; 10 Digits.


A test failure message can also include values, including values dynamically included from other SEGMENTS and FIELDS.


For example, consider a mapping project for Customer Master and fields in the Company Code segment of the project (segment E1KNB1M). Tolerance Group (TOGRU) is an example of a field that may be validated with a Database Lookup test, but the lookup depends on the value supplied for Company Code.  It would be helpful to include the value of the company code in the test failure message.


Here's an example test failure message with the syntax to include the Company Code value:


Value Not Found In Table T043G, Field TOGRU for Company Code [[E1KNB1M-BUKRS]].


Notice the SEGMENT-FIELD name enclosed in double square brackets.  When this part of the test failure message is included in a tool tip or report, the SEGMENT-FIELD name enclosed in double square brackets will be replaced by the last value found in that SEGMENT-FIELD.   Thus, if the last Company Code supplied in segment E1KNB1M-BUKRS was 1000, the displayed test failure message would be:  

Value Not Found In Table T043G, Field TOGRU for Company Code 1000.


Tests can be copied and pasted, from one field to another, and even from one mapping project to another.  To copy one or more tests, select one or more rows using the row selectors in the grid and then press Control + C.  To paste one or more tests, select one or more rows using the row selectors in the grid and then press Control + V.


Right clicking the bottom grid area offers a context sensitive menu to add a new test.



Validation Tests Overview


All tests return a result of True or False when executed.  If the result is False then the validation for that field is considered to have failed.


If multiple tests are defined for a given field and any one test result is False then the validation for that field is considered to have failed.


There are many kinds of tests, but two tests in particular will likely satisfy most validation requirements:




Every mapped field should include at least one validation test. To that end, there is a menu option to automatically create a basic validation test (field length) for all fields in a Map Project.



Introduction to Pattern Matching Tests


Assuming that there are no existing Validation Tests, begin by clicking the Initialize button (a sub-menu under Validate on the Home Ribbon tab).  This will create basic pattern matching tests for all fields in all segments.  For example, field length checks for CHAR fields, numeric and length checks for NUMC fields, and fields that are marked as SAP Mandatory are checked for empty values.


You can now peruse the active fields and see the tests that were created. With just one click you've created a simple test for every field; it's a good start.


After these simple tests have been created, the next level is to consider more sensible pattern matching for each active field.  Starting at the top and working to the bottom of the segment and field list is a practical way to tackle this task.  


It's a bit easier to review the active fields in the project if only the active segments and fields are displayed.  To achieve this, have a look at the View ribbon on the toolbar.  Clicking the Filter Active button and then the Expand button will result in a display of only active segments and fields, and all of the segments will be expanded.


Pattern matching tests are created using the test ValueIsPattern.



Introduction to Database Lookup Tests


The Validation Engine uses data in the Local System Database (e.g. data extracted from an SAP system) to validate Sample Data or Load Ready files.  


In order to extract the needed data from an SAP system, the first step is to identify those active fields in the mapping project that have an associated Value Table, which designates the SAP table against which the value is to be checked. For example, the basic data for Customer Master includes a mandatory field for Customer Account Group (KTOKD), which is assigned a Value Table of T077D (Customer account groups). Only Customer Account Groups found in Table T077D will be accepted when creating a Customer Master.


This task is made easier by the fact that each data element in a mapping project automatically includes a Value Table designation when one is defined by SAP. There are buttons on the Home ribbon to enable the efficient usage of Value Tables and efficient extraction of data from an SAP system:




After using the Tables Map button to create a mapping project of the Value Tables, use the map project to Transfer Data from SAP tables to a Local System Database.  

Save the map project of value tables for reuse; you'll be able to refresh data in your Local System Database -- quickly and on demand -- by opening the map project of value tables and again using the map project to Transfer Data from SAP tables to a Local System Database.  This process can be repeated as often as needed, keeping the Local System Database aligned with configuration changes. Moreover, you'll want to perform the Transfer Data from SAP tables to a Local System Database using different source SAP systems-clients as appropriate.


With relevant tables and data now available in the Local System Database, you're ready to begin creating Database Lookup Tests that will validate values against the extracted data.


Database lookup tests are created using the test ValueInPickList.  



See also: