
INTRODUCTION
SAP Graphical User Interface for windows is a platform that automates the features of SAP application. DevOps Test UI (abbreviated as DTUI) supports the testing of SAP-based applications by using SAP tests and facilitates the validation of the functionalities during script playback.
The substitution of this data can be used for testing the following scenarios during script execution:
- To substitute the reference value in the input field or text field during script execution.
- To filter specific information from a large set of data.
- To use the substituted reference value for comparison with other data.
- To create multiple references for fetching the string values, and this data can further be used to perform some validation checks.
Methods used to fetch the runtime data from SAP GUI application and perform a Variable Assignment and Substitution in DevOps Test UI:
The implementation of the runtime data fetch and variable assignment, and substitution of the variable in the SAP test scripts can be done with the help of SAP Get and SAP Set methods in Test UI.
SAP Get : This method is used to fetch or retrieve the data from the SAP GUI object.
SAP Set : This method is used to set or assign a specified value to the SAP GUI object.
Steps to fetch a runtime data from SAP GUI, and substitute it in the SAP test step:
The detailed steps to fetch a runtime data and perform a variable assignment through reference, and variable substitution is divided into three segments:
- To fetch the runtime data using SAP GET method and to create a Field Reference.
- Substitution of a Field Reference in SAP SET method.
- Perform a Variable assignment of the fetched reference value and pass the value in the another test.
To fetch the Runtime data using SAP Get method and to create a Field Reference for the fetched value
- Launch IBM DevOps Test UI in UI Test perspective.
- Record a new SAP test.
- Select the test step, which contains the runtime data to be fetched.
- Navigate to the SAP Protocol Data -> Screen Capture tab to highlight the value.

- Right-click on the value and select the option Create Element.

- In the Create Element dialog window, select the radio button for Advanced option.
- In the Element type dropdown box, choose as the option SAP Get. The SAP Get method helps to fetch the string value New password during runtime from the SAP GUI application.

- The Property to get field is set automatically based on the object used for creation of element for SAP Get type.

- Click on Finish button to proceed with the creation of new test step for SAP Get method.
- The highlighted test step is added to the test script post creation of the test step for SAP Get element.

- To create a Reference for the string value fetched from SAP Get method, select the string value New password from the Value field and click on Create Reference option.

- Enter a name for the reference in the Name field and click on the Apply and Close button in the Reference dialog.

- The string value New password for the created reference Field Content appears in blue color. Click on the No button in the Test Editor - Find and Substitute dialog.

- The reference is created successfully. Here the created reference name is Field Content for the string value New password. Now save the SAP test .
Substitution of a Field Reference in SAP SET method
- Navigate to the SAP Set method test step in the SAP test.

- Select the value from Value field and right click on the same.

- Navigate to the Substitute -> Reference: Field Content option to substitute the fetched string value New password to the input/text field in SAP Set method test step.

- Click on the No button in the Test Editor - Find and Substitute dialog. The value appears in pink color after substituting with reference.

- The substitution is created successfully, now save the test.
To Perform a Variable assignment of the fetched reference value and to pass the value in the another Test Script
- Navigate to the Test Variables -> Add -> Variable Declaration to declare a variable

- Provide the variable name and click on the OK button.

- The visibility for the declared variable Testvar will be by set to This test only.

- The visibility for the declared variable Testvar must be set to All tests for this user to set the access type of this variable as global variable. The Testvar variable now can be accessed by all the tests.

- Right-click on the SAP Get test step and navigate to Insert -> Variable Assignment.

- Select the created Test Variable from Test Editor dialog and click on the OK button.

- The Variable Assignment test step would be added below the SAP Get test step.

- Select the Variable Assignment test step and choose the Data Source value option under Variable Assignment Details.

- Select the checkbox of the created Field Reference under Select Data Source window and proceed with the Select button.

- The fetched runtime value will be assigned to the Test Variable Testvar during script execution. The Variable Testvar value can be referred for passing the value to another test script in the compound test.

- In the saptest1(Test2) test script, declare a Test Variable with same name Testvar and set the visibility of the variable to All tests for this user. This variable helps to pass the runtime value from one Test sap(Test 1) to the another Test saptest1 (Test2). Here both the test scripts should be added in the Compound Test.
Testvar variable assignment in Test 1 sap:

Testvar variable Declaration in Test 2 saptest1:

- Now add both tests in a Compound Test com.

- In the second test saptest1, the Testvar variable value from sap test can be substituted in the SAP Set test step method in saptest1.

- Select the value under SAP Set to perform variable assignment and substitute this value.

- Select the Testvar variable and proceed with the Variable substitution in the second test saptest1. The fetched Variable value from first test sap will be used in the second test saptest1 during script execution.

Summary:
In short, the usage of SAP Get and SAP Set methods enhances flexibility in the test script customization and execution workflow, helping users with the reference creation, variable assignment and substitution of the runtime fetched dynamic values in a SAP test.
#Highlights-home