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 July 2016

SAP Automation tidbits

Below are tidbits used when you are automating SAP applications.


''' Generic function to verify success message displays in status bar

Public Function SAP_VerifySuccessMsg(objSAPWindowName)

On Error Resume Next
 Report_WriteStepHeader("<B> Verify Success Message in the statusbar </B>")
 SAPGuiSession("SAPSession").SAPGuiWindow(objSAPWindowName).SAPGuiStatusBar("StatusBar").Sync
 
 strSBarSuccessMsg = SAPGuiSession("SAPSession").SAPGuiWindow(objSAPWindowName).SAPGuiStatusBar("StatusBar").GetROProperty("text")

 intTransNum = Trim(Split(Split(strSBarSuccessMsg,"Transaction ")(1)," saved")(0))
 Print intTransNum
 On Error GoTo 0
 SAP_VerifySuccessMsg = intTransNum
End Function

''Making fields values empty:
SAPGuiSession("SAPGuiSession").SAPGuiWindow("Purchasing Documents").SelectMenuItemById "DELSCTX"

If SAPGuiSession("SAPGuiSession").SAPGuiWindow("Purchasing Documents").SAPGuiEdit("Purchasing document").Exist(intMinSyncTime) Then
  PODefaultValue=SAPGuiSession("SAPGuiSession").SAPGuiWindow("Purchasing Documents").SAPGuiEdit("Purchasing document").GetROProperty("value")

  If PODefaultValue<>"" Then
     SAPGuiSession("SAPGuiSession").SAPGuiWindow("Purchasing     Documents").SAPGuiEdit("Purchasing document").SetFocus
     SAPGuiSession("SAPGuiSession").SAPGuiWindow("Purchasing Documents").SAPGuiEdit("Purchasing document").SetCaretPos 0

     Set WScript = createobject("WScript.Shell")
     WScript.SendKeys "^"+"{A}"
     WScript.SendKeys "{DEL}"
     Set WShell = Nothing
  End If
End If

''''################### to make sure cell is editable in SAP table

BlockCellEditable1 = SAPGuiSession("SAPGuiSession").SAPGuiWindow("Change S/O SysB SDI 4"). SAPGuiTable("Dates").IsCellEditable(1"Block")
    If Trim(BlockCellEditable1)="True"  Then
      SAPGuiSession("SAPGuiSession").SAPGuiWindow("Change S/O SysB SDI  4"). SAPGuiTable("Dates").SetCellData 1,"Block",""
      SAPGuiSession("SAPGuiSession").SAPGuiWindow("Change S/O SysB SDI 4").
SAPGuiTable("Dates").SelectCell 1,"Block"
      SAPGuiSession("SAPGuiSession").SAPGuiWindow("Change S/O SysB SDI 4").SendKey ENTER
 
      If SAPGuiSession("SAPGuiSession").SAPGuiWindow("Information").Exist Then
       SAPGuiSession("SAPGuiSession").SAPGuiWindow("Information").SAPGuiButton("Continue   (Enter)").Click
      End If
    End If

'''############Changing reply mode type

Setting.WebPackage("ReplayType") = 2 'Mouse
Browser("KnowledgeInbox").Page("ReplayType").WebEdit("txtReplayType").Set "KnowledgeInbox"
Browser("KnowledgeInbox").Page("ReplayType").WebButton("Type and enable me").Click
Setting.WebPackage("ReplayType") = 1 'Events
'''############

No comments:

Post a Comment

Note: only a member of this blog may post a comment.