SAP — Expand tree node
SAP — Expand tree node
Section titled “SAP — Expand tree node”Type: sap-tree-expand · Package: SAP Activities v1.0.5
Expands a node of an SAP tree so its children become visible, or collapses it if you turn on collapse. Use it to reach a node inside a closed branch, or before reading the tree with SAP — Read tree so the read includes those children.
How it works
Section titled “How it works”Waits for SAP to finish whatever it is processing, finds the tree by its selector and expands the node whose key is nodeKey (or collapses it, with collapse = true). Then it waits for SAP to load the content.
The node is given by its key, not by its text. The key is assigned by the SAP program and usually carries significant spaces; that is why it is best to take it from the output of SAP — Read tree instead of typing it by hand. If the tree does not accept the key, the activity fails with a message that reminds you of this.
If the tree is not on the screen yet, the activity waits for it up to the configured limit (timeout or the scope’s elementTimeout, 30 seconds by default).
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
selector | selector | — | The tree (GuiTree). Captured selector or SAP id, for example wnd[0]/usr/cntlTREE/shellcont/shell. |
nodeKey | string | — | Node key. Get it with SAP — Read tree: it is not the visible text. Ex: " 1". |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanSapSession | — | SAP session. Omit it inside the body of an SAP — Attach or SAP — Log on. |
collapse | bool | false | Collapse the node instead of expanding it. Also accepts an expression that returns true or false. |
timeout | number | — | Seconds to wait for the tree to appear. Overrides the scope’s elementTimeout. Empty uses the scope value (30 by default); 0 fails on the first try. Decimals allowed. |
Output
Section titled “Output”This activity does not return a value.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
The tree did not accept the key '…'. Keys are assigned by the ABAP program and carry significant spaces; get them with sap-tree-read instead of typing them by hand. (…) | The key doesn’t exist in the tree, or has missing or extra spaces. Take it from the output of SAP — Read tree. |
Component '…' does not exist in the SAP session. Waited … s for it to appear. The current screen is … dynpro … (transaction …). … | The element did not appear in time. The message says which screen the session is on: it is almost always a different one than expected (a dialog in front, a step that didn’t happen). If the screen is slow, raise timeout. |
Plus the errors common to all activities.
Example
Section titled “Example”Expand a folder and read the tree with its children now visible:
SAP — Read tree selector = "wnd[0]/usr/cntlTREE/shellcont/shell" → output: nodesSAP — Expand tree node selector = "wnd[0]/usr/cntlTREE/shellcont/shell" nodeKey = nodes[0]["key"]SAP — Read tree selector = "wnd[0]/usr/cntlTREE/shellcont/shell" → output: nodesRelated activities
Section titled “Related activities”- SAP — Read tree — get the node keys.
- SAP — Select tree node — select or open a node.