I would like to know if i can able to identify activeitem(below code) is available in SapGuiTree in SAP.
code:
SAPGuiSession("guicomponenttype:=12").SAPGuiWindow("guicomponenttype:=21").SAPGuiTree("treetype:=SapColumnTree").ActivateItem "Inbound Monitor;11.05.2016;1111;Sales Movement","Sales Movement"
i tried below method but not worked
if isNull 'code' then else statement end if
Can anyone suggest any method to identy this issue
Thanks in advance.
You can achieve this by checking all the node values under a SAPGuiTree
object.
'Set Object
Set TreeObj = SAPGuiSession("a").SAPGuiWindow("b").SAPGuiTree("c").Object
'First you need to get all values under this tree
Set AllValues = TreeObj.GetAllNodeKeys
'Get count
Count = AllValues.Count
'Begin search the value you want
Found = 0
For i = 0 to Count-1
NodeText = TreeObj.GetNodeTextByKey(AllValues(i))
If NodeText = "SearchValue" Then
Found = 1
Exit For
End if
Next
If Found = 1 Then
'Do something
End if
Update1:
You can also use Regular Expression to do a pattern match when searching your desired value under a tree
object.