Script design notes - data validation

SAP Data Validation

SAP rules can be validated using Winshuttle Transaction, for both Microsoft Excel and Web form interfaces.

In Winshuttle Transaction, validation works the same way it would if you were entering all the data into the SAP GUI and pressing "enter", which then checks that all required fields are populated and valid.

How Winshuttle data validation works with multiple lines
For multi-line items, data validation works on one record per line items basis. For each line item, the header is appended to the line item and passed on as a single record. This means that if there are 10 line items for a document posting, it would be similar to validating 10 documents with one line item each. Accordingly, if there is an error at the header, this will appear as the error for every line item.

There are 2 options for validating SAP rules using Winshuttle Transaction.

Option 1: Build a standard update (create or change) script that uses the Transaction validation feature inside the mapper (just toggle it to Validation On--see below for an example). This is the preferred method because it is more flexible. See the Winshuttle Transaction Advanced Guide for more details.

Important: Before you turn validation on, be sure that the script contains only one commit code and that the commit code appears at the end of the script.

A commit code represents any kind of save action. Example commit code values include =BU and =SICH.

If a transaction script contains more than one commit code, some of the data might be committed to SAP during validation. This has been fixed in Studio v11.0.2.

Note: Transaction's default is Validation Off

When using a web form, this method makes a checkbox available in the form that can be used to toggle validation on or off.

  • When the validation is on, clicking the button for the Web service will validate the service instead of running it.
  • When validation is off, clicking the button for the Web service will actually run the script.

If you want the user to validate first then it is recommend to set the default for the checkbox to the ON position in the form.

Option 2: Build a script that validates (only) and does not update. This method is recommended only if you are unable to use option 1 (above). You can do this by:

  1. Recording a script similar to an upload script
  2. At the end of the recording, press the Enter key, and click exit or cancel instead of saving.

With this script, clicking Run will run the validation script and not an update script. In this case you do not need to turn on the validation feature inside the mapper as shown in the first option.

This option is usually needed if you want to just validate a partial T-code for a specified user (for example, breaking up a T-code for multiple users to contribute.) This type of script usually requires more total scripts for a solution.