CBTA is a SAP Testing tool which is used to record and execution of Test scripts in SAP Solution Manager system.
Some transaction like ME21N and ME51N are having Dynamic SAP GUI sub-screens and they can be either in closed or open position. Please find the screenshot.
Everyone who has worked on CBTA has come across the issue of Sub screens in the Test script recording and execution where the sub-screen should be in same position while executing in which Test Script was recorded. However, transactions ME21N and ME51N are having dynamic screens which remember the behavior of how it was last used, either closed or open. So it is quite difficult to have the same behavior of SAP dynamic screen otherwise the Test script will throw this type of error while execution.
SCREEN COMPONENT FAILED:
Transaction Code: AC03
Screen Number: 0300
Screen Name: ServiceMasterOverallScreenwithTreeControl
There are multiple ways to resolve the problem and two of the recommended approach are explained by Reiner Markheiser. Please find the link for the same.
https://blogs.sap.com/2014/08/21/test-automation-challenges-dynamic-sap-gui-screen-state-eg-me51n/
The other recommended approach is to use of SAP provided patterns through VBscripts. The SAP-delivered patterns are stored in the MIME repository of the SAP Solution Manager system, under SAP ➔ PUBLIC ➔ CBTA ➔ PATTERNS ➔ SAP_GUI
We have two standard patterns available which can be used for SAP Dynamic screen issue.
- ME21N_ExpandAllSections.vbs
- ME51N_ExpandAllSections.vbs
SAP has provided these VBScripts but you cannot use it directly in the Test Script. To use those, you have to maintain the custom function in the Runtime Library Manager.
How to Access Runtime Library Manager
To access the Runtime Library Manager, Go to Test Suite ➔ Administration
In the new Window, Select CBTA Tab and choose the Customize RTL Link.
In the RTL manager logon screen, enter the credentials of your Solution Manager system. Note that the current system will be selected by default and you cannot change the same.
It is possible that you might face authentication issues, so please check Snote - 1912801
If you are opening RTL manager for the first time, after entering the login credentials, the next screen will look like this.
How to create Custom Function
Before we can start creating Custom Function, first of all, we need to stage the Runtime Library Manager.
For this, Choose
Open for Edit button.
Choose a folder to store the Official Runtime Library and once done, choose
Explore Button.
Once done, at the selected directory, a CBASE folder will be created. The CBASE folder contains CBASE configuration and the VB script files.
Once these steps are completed, we can proceed with custom function creation.
To proceed with the custom function creation with
ME21N_ExpandAllSections.vbs script, Go to Functions Tab in Runtime Library Manager.
Choose
Code Assistant button and below screen will open and then Choose
Select option.
Select the pattern and click on
Next Button and enter the Custom Function Name.
Please note, the Custom Function name should be unique and it cannot be changed once setup.
Click on
Finish button and the custom function will be created in the Runtime Library Manager.
Now, we can use the custom function in the Test Script and test if its working perfectly or not.
How to use Custom Function in Test Script
The main function of this ME21N_ExpandAllSections script is to expand all the dynamic screens(sub-screens) available in the ME21N transaction.
This custom function has no input parameters, so it can be called by the CBTA_GUI_A_EXECUTESTATEMENT default component.
The input parameters for calling for the statement – CBTA_GUI_A_EXECUTESTATEMENT will be:
- Library – The name of the VBScript File(Ex. Custom\ME21N_ExpandAllSections.vbs)
- Statement – The Statement to execute(ME21N_ExpandAllSections)
Once these has been entered, the dynamic screens or sub screens present in the screen will be expanded in the transaction accordingly.
The actions performed by the custom function will be displayed in the execution report, please check the execution log.
As you can see, the first dynamic screen(sub-screen) which was available was closed and the custom function expanded the same. And the other dynamic screens(sub-screens) were already expanded, hence it skipped the action. In this way, it will not throw an error if it is already expanded.
The custom function which has been created is available for the respective person only. To have it available for everyone, one has to submit the customizations of the Runtime Library Manager. To do the same, open the Runtime Library Manager.
To submit the changes, Click on
Submit button and Please enter the following parameters.
- Company Name: Enter the company name. This value is not verified.
- Version: Version of the customization. Again, this value is not verified.
- Change Request: Enter the TR details if you want to move the changes to another SolMan system in your landscape.
- Package: Enter the package for moving the changes to another system.
If the change request and Package are not entered, it will be saved as locally and will not transported.
Once done, click on okay and status of the customization will change to
Customization is active
The changes will be active for everyone who wants to use this custom function in the Test Script.
If you want to have more understanding on the Patterns and how to create Custom functions, please check the documentation which is made available by SAP at the time of CBTA installation.
Please follow the default path:
C:\Program Files (x86)\SAP\CBTA\documentation
Now you can use VB script to create your custom functions and expand the dynamic screens(Sub-screens) in the SAP GUI.