Hi Annie,
my suggestion is as follows:
. . . session.findById("wnd[0]/shellcont[1]/shell/shellcont[0]/shell/shellcont[1]/shell/shellcont[0]/shell").pressButton "%AWB_TREE_SEARCH" session.findById("wnd[1]/usr/txtRSAWBN_S_DYNPRO_0500-SEARCH_TERM").Text = ws1.Cells(9, 10).Value 'The following command is not absolutely necessary and could lead to an error if the length of the parameter to be searched is less than 8. 'session.findById("wnd[1]/usr/txtRSAWBN_S_DYNPRO_0500-SEARCH_TERM").caretPosition = 8 session.findById("wnd[1]").sendVKey 0 myKey = session.findById("wnd[0]/usr/cntlCNTL_CONTAINER/shellcont/shell/shellcont[0]/shell/shellcont[1]/shell[1]").getFocusedNodeKey() session.findById("wnd[0]/shellcont[1]/shell/shellcont[0]/shell/shellcont[1]/shell/shellcont[1]/shell").SelectItem myKey, "COL1" session.findById("wnd[0]/shellcont[1]/shell/shellcont[0]/shell/shellcont[1]/shell/shellcont[1]/shell").ensureVisibleHorizontalItem myKey, "COL1" session.findById("wnd[0]/shellcont[1]/shell/shellcont[0]/shell/shellcont[1]/shell/shellcont[1]/shell").itemContextMenu myKey, "COL1" session.findById("wnd[0]/shellcont[1]/shell/shellcont[0]/shell/shellcont[1]/shell/shellcont[1]/shell").selectContextMenuItem "MANAGE" . . .
Regards,
ScriptMan
Hi Annie,
the variable myKey expects a string and not Object.
myKey = session.findById("wnd[0]/usr/cntlCNTL_CONTAINER/shellcont/shell/shellcont[0]/shell/shellcont[1]/shell[1]").getFocusedNodeKey()
without command set at the beginning... ;-)
And if it still does not work, you could use the following command.
for example:
session.findById("wnd[0]/shellcont[1]/shell/shellcont[0]/shell/shellcont[1]/shell/shellcont[0]/shell").pressButton "%AWB_TREE_SEARCH" session.findById("wnd[0]/usr/cntlCNTL_CONTAINER/shellcont/shell/shellcont[0]/shell/shellcont[1]/shell[1]").setFocus() . . .
Regards,
ScriptMan
Hello Annie,
yes it is possible to get the selected items (nodes).
Dim Nodes As SAPFEWSELib.GuiCollection Set Tree = session.findById("wnd[0]/shellcont[1]/shell/shellcont[0]/shell/shellcont[1]/shell/shellcont[1]/shell") Set Nodes = Tree.GetSelectedNodes
With GetSelectedNodes you get all selected nodes, because with the GuiTree of TAC RSA1 is it possible to select multiple items.
Here you see my three selected nodes.
Let us know your results.
Cheers
Stefan
P.S. I think you can find useful information about trees here.
Add comment