Tricentis Tosca 16.0 Released on Feb-2023 ----- UFT has been upgraded from UFT 15.0.1 to UFT One 15.0.2, Beginning at November 2020.

Sunday 31 January 2021

Deselect the specified column in a sap table.


First it selects three columns in the table and sorts them in ascending order. Then it clears the "Confirmation" column and sorts the selected

'columns in descending order.
SAPGuiSession("Session").SAPGuiWindow("Access").SAPGuiOKCode("OKCode").Set"me21n"
SAPGuiSession("Session").SAPGuiWindow("Access").SendKey ENTER

SAPGuiSession("Session").SAPGuiWindow("Confirmation").SAPGuiButton("Execute   (F8)").Click
SAPGuiSession("Session").SAPGuiWindow("Confirmation").SAPGuiTable("SAP").SelectColumn "Confirmation"
SAPGuiSession("Session").SAPGuiWindow("Confirmation").SAPGuiTable("SAP").ExtendColumn "Order"
SAPGuiSession("Session").SAPGuiWindow("Confirmation").SAPGuiTable("SAP").ExtendColumn "Operation"
SAPGuiSession("Session").SAPGuiWindow("Confirmation").SAPGuiButton("Sort in ascending").Click
SAPGuiSession("Session").SAPGuiWindow("Confirmation").SAPGuiTable("SAP").DeselectColumn "Confirmation"
SAPGuiSession("Session").SAPGuiWindow("Confirmation").SAPGuiButton("Sort in descending").Click

      

Find the no of columns in the given table, if no of columns in not equal to the required count, then click filter button and change layout of the table.

 

Dim TableColumns

SAPGuiSession("Session").SAPGuiWindow("Access").SAPGuiOKCode("OKCode").Set "me23n"
SAPGuiSession("Session").SAPGuiWindow("Access").SendKey ENTER
TableColumns = SAPGuiSession("Session").SAPGuiWindow("PO").SAPGuiTable("SAP").ColumnCount

If TableColumns < 4  Then
     SAPGuiSession("Session").SAPGuiWindow("PO").SAPGuiTable("SAP").SelectCell 1,"item" 
     SAPGuiSession("Session").SAPGuiWindow("PO").SAPGuiButton("Set filter").Click
     SAPGuiSession("Session").SAPGuiWindow("filter").SAPGuiGrid("GridView").SelectCell 5,"ColumnName"
     SAPGuiSession("Session").SAPGuiWindow("filter").SAPGuiGrid("GridViewCtrl").SelectRow 5
     SAPGuiSession("Session").SAPGuiWindow("filter").SAPGuiButton("Add filter criterion").Click
     SAPGuiSession("Session").SAPGuiWindow("filter").SAPGuiButton("Enter").Click
End If  



Saturday 30 January 2021

Retrieves the collection of WebEdit objects, which has shipping details and inserts the information in an Excel file.


Dim numberOfEdits

'Create a Description object
Set oDesc = Description.Create()
oDesc("micclass").Value = "WebEdit" 

'Retrieve all WebEdit objects from this page.
Set editCollection = Browser("Shipping").Page("Shipping").ChildObjects(oDesc)
numberOfEdits = editCollection.Count

'insert all retrieved information in an Excel file.
For i = 0 To numberOfEdits - 1
     CurrentInfo = editCollection(i).GetROProperty("text")
     WriteToExcelFile (CurrentInfo)
Next

' inseting values into excel
Function WriteToExcelFile (CurrentInfo)
    Dim oExcel, oWB, oSheet, setVal
    Set oExcel=CreateObject("Excel.Application")
    Set oWB=oExcel.Workbooks.Open("C:\test.xls")
    Set oSheet=oWB.WorkSheets("Sheet1")
    oExcel.Visible=TRUE  

    For i = 0 To CurrentInfo  - 1
         oSheet.Cells(i,1).Value=CurrentInfo    
    Next

    oWB.Save
    oWB.Close
    Set oExcel=Nothing
End Function


Find all the list objects on a Web page, and then to select an item in each list, Using ChildObjects method.



Set oDesc = Description.Create()
oDesc("micclass").Value = "WebList" 
Set Lists = Browser("Shopping").Page("Shopping").ChildObjects(oDesc)
NumberOfLists = Lists.Count()

For i = 0 To NumberOfLists - 1
    Lists(i).Select i + 1
Next





Thursday 28 January 2021

ActivateCell method in SAP table


SAPGuiSession("Session").SAPGuiWindow("SAP").SAPGuiOKCode("OKCode").Set "va01"
SAPGuiSession("Session").SAPGuiWindow("SAP").SendKey ENTER

SAPGuiSession("Session").SAPGuiWindow("DisplaySales").SAPGuiEdit("Order number").Set "5121"
SAPGuiSession("Session").SAPGuiWindow("Display Sales").SAPGuiButton("Enter").Click

SAPGuiSession("Session").SAPGuiWindow("Standard").SAPGuiTable("SAPMV4").ActivateCell"1","Material"
SAPGuiSession("Session").SAPGuiWindow("Display").Check CheckPoint("Display Standard_2")