Skip to Content
Technical Articles
Author's profile photo Rittika Sood

How to retrieve values from UI – Component Based Test Automation(CBTA)

Solution Manager 7.2 SP 16

CBTA 3.0 SP 19.2



CBTA test scripts are not built by writing any coding. They are built by aggregating components. A common need in test script recording/execution is to retrieve the value of screen components from UI. It is required to map the value of output parameters from one test script to other test script to test end-to-end business scenarios. In this blog post we will discuss about various techniques of retrieving information from SAP GUI so that values can be mapped to other child scripts.


Scenario 1 – Retrieving information from status bar

In this scenario, we want to retrieve the information from the success message in status bar. This can be easily accomplished via execution context. The execution context can be seen as a shared memory where information is stored to make it available to the subsequent steps of the test script.

With CBTA, the execution context can be populated with computed values. The typical use case is to dynamically create a variable, in which the result of a step is stored and reused by the next ones.

For example, the business scenario could be to use the VA01 transaction to create a Sales Order and use the ID of the newly created sales order in the YME59 transaction to create a PO.

Sales order creation will generate a success message in status bar. This example can be automated using the CBTA_GUI_SB_GETMESSAGEPARAMS component. This component retrieves the parameter values of the status bar and stores them in variables that are prefixed by the transaction code.

The status bar of the VA01 transaction creates the following variables:

  • VA01_MessageStatus
  • VA01_MessageParameter0
  • VA01_MessageParameter1

The information retrieved from the status bar (of type GuiStatusbar) is visible in the execution report, as shown below:

The runtime library resolves the value of each component parameter by replacing each token with the value of the corresponding variable. This value can be easily mapped to subsequent scripts.


Scenario 2 – Retrieving information embedded in SAP GUI screen

In this scenario, we want to retrieve the information embedded in SAP GUI screen. CBTA relies on the concept of components. Most of the components are used to simulate user interactions. Some others are used to verify the application consistency; they get information from the UI and provide the ability to perform checkpoints

For example, retrieving the value of Purchase Requisition from below SAP GUI screen.

Another example could be retrieving the value of Purchase order from below SAP GUI screen.

To achieve this, the Test Engineer can define checkpoints while recording the scenario in CBTA Test recording Wizard. Each checkpoint will be converted into a step in the generated test script. The component used to perform the check may vary depending on the UI technology used by the application being tested.

We may press the “Add Checkpoint” button while recording the script to start the Check Picker mode.

The test engineer can define checkpoints to verify the consistency of the application or to simply retrieve information from the UI.

  • Check Data must be selected to define a checkpoint
  • Get Data must be selected to retrieve information

Check data details

The default components used to perform the checks for SAP GUI transactions are:


While recording the script, press “Add checkpoint” button to start the check picker mode.

Select the component from SAP GUI screen whose value needs to be captured.

The wizard creates the checkpoint and adds it to the list of steps with some default settings.

In this example, the checkpoint checks the Purchase order number, but we only want to retrieve the information. Convert the checkpoint to a simple Get Data step by selecting the radio button ‘Get Data’. The corresponding step is updated and the component, which the test will use at runtime, is shown in Step Details section.

This value in CBTA_GUI_GETPROPERTY component can be easily passed to subsequent script.


Scenario 3 – Retrieving information from Strings

In this scenario, we want to retrieve the information from SAP GUI screen pop-up screen.

We can easily retrieve the value using ‘Add checkpoint’ and ‘Get Data’. But the only challenge is that ‘Get data’ will retrieve full sentence i.e., Inbound delivery 190090339 has been saved. Our objective is to map the value of Inbound delivery ‘190090339’ to subsequent script.

There are many ways to achieve this using VBScript functions. Here, I am using a simple split function to get inbound delivery number.


Firstly, during script recording retrieve the value from SAP GUI screen using ‘Add checkpoint’ and ‘Get Data’ as explained in the previous scenario.

Open the script in edit mode in TCE (Test Composition Environment) and select the Default component which captures text from the SAP GUI screen i.e., CABTA_GUI_GETPROPERTY. In ‘Parameters’ tab of this default component make TARGETFIELD exposed and give a name to it (e.g. COMPLETE_TEXT).

This provides the text string to the execution context as a token with name COMPLETE_TEXT.


Next step is to add a new default component CBTA_A_SETINEXECUTIONCTXT and make the usage type of both the parameters as ‘Fixed’. Enter a new name ‘NUMBER_ONLY’ for parameter ‘Name’  and provide value %=Split($COMPLETE_TEXT$,” “)(2)% in ‘THEVALUE’ parameter.

This function splits the text into sub strings using space (” “) as delimiter and returns the 3rd sub string. First sub string starts at count (0), so value of Inbound Delivery will be at position (2).


Finally, add another default component CBTA_A_GETFROMEXECUTIONCTXT to read the number from the token in execution context and write to an output parameter which can be used as import parameter in subsequent scripts. Set usage of parameter ‘NAME’ to Fixed and Exposed for OUTPUT.

Inbound delivery number can be easily mapped to subsequent scripts using few default components and VB functions.


Hope you have enjoyed this blogpost!!

Happy Learning!

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Kapil Pandey
      Kapil Pandey

      Very nicely explained Ritika. Very informative blog.!!