Dynamically Invoking Methods on SAP Controls

When Silk Test Workbench cannot record actions against an SAP control, you can record the actions with the recorder that is available in SAP and then dynamically invoke the recorded methods in a Silk Test Workbench script. By doing so, you can replay actions against SAP controls that you cannot record.
  1. To record the actions that you want to perform against the control, use the SAP GUI Scripting tool that is available in SAP. For additional information on the SAP GUI Scripting tool, refer to the SAP documentation.
  2. Open the recorded actions from the location to which the SAP GUI Scripting tool has saved them and see what methods were recorded.
  3. In Silk Test Workbench, dynamically invoke the recorded methods from your script.

Examples

For example, if you want to replay pressing a special control in the SAP UI, which is labeled Test and which is a combination of a button and a list box, and selecting the sub-menu subsub2 of the control, you can record the action with the recorder that is available in SAP. The resulting code will look like the following:
session.findById("wnd[0]/usr/cntlCONTAINER/shellcont/shell").pressContextButton "TEST"
session.findById("wnd[0]/usr/cntlCONTAINER/shellcont/shell").selectContextMenuItem "subsub2"
Now you can use the following code to dynamically invoke the methods pressContextButton and selectContextMenuItem in your script in Silk Test Workbench:
.SapToolbarControl("shell ToolbarControl").Invoke("pressContextButton", "TEST")
.SapToolbarControl("shell ToolbarControl").Invoke("selectContextMenuItem", "subsub2")
Replaying this code will press the control in the SAP UI and select the sub-menu.