Purpose Select a tree node Solution Use the predefined VB function guinet.TreeControl.SelectNodeByPath specifying the hierarchical node path. If you know the technical node key, you may use guinet.TreeControl.SelectNodeByKey Examples: CallVBAsync guinet.TreeControl.SelectNodeByPath "Shipping Instruction\EN" or CallVBAsync guinet.TreeControl.SelectNodeByKey "TXT03EN" Both functions allow us to specify a list of node identifiers (by path or by key) which are searched one after the other. The functions return the number 1,2,... of the matching identifier, or 0 if no matching node can be found. Example: CallVBAsync textno = guinet.TreeControl.SelectNodeByKey "TXT03DE,TXT03EN,TXT03FR" Please note: In relatively large trees, for example the SAP Easy Access tree or the SAP Reference IMG (transaction SPRO), the tree control does not load all nodes immediately but waits until the user requests a particular subtree. A selection by key with SelectNodeByKey will fail if the node is not yet loaded into the tree control. But the selection by path with SelectNodeByPath will work for such "lazy loading" trees, since GuiXT automatically expands all subtrees of the given hierarchical path during its search. |
In our InputScript that reads the text we need to select the right node in the text selection tree in VA03:
To identify the node, we can either use the hierarchical path "Shipping instruction\EN" or the internal SAP node key "TXT03EN". Here TXT03 is the configured text id and EN is the language code. In other trees, the internal node keys may be meaningless numbers. Tip: The command CallVBAsync guinet.TreeControl.GetSelectedItem reads both the current node path and the node key into GuiXT variables which you can display in the GuiXT Debug window:
GuiXT script GuiXT
InputScript "read_shipping_instruction.txt" GuiXT
Please observe: In your InputScript you need a separate Screen...Enter block for the tree node selection.
|
Components |