SAP — Select menu
SAP — Select menu
Section titled “SAP — Select menu”Type: sap-select-menu · Package: SAP Activities v1.0.5
Selects an entry in the menu bar of the main SAP window, just like a person opening a menu and clicking an entry. You can give the entry by its technical id (selector) or by the path of texts shown on screen (path), for example "System > List > Save".
How it works
Section titled “How it works”It needs one of the two: selector or path. If you give neither, the activity fails. If you give both, selector is used. An empty selector (for example, because you cleared the field in the Designer) counts as not given, so path is used in that case.
- By
selector: finds the entry by its id, for examplewnd[0]/mbar/menu[0]/menu[2], waiting for it to appear up to the configured limit (timeoutor the scope’selementTimeout, 30 seconds by default). - By
path: starts at the menu bar of the main window and walks the path level by level, split by>. Each level is compared with the entry text, ignoring upper and lower case. If a level does not exist, the error lists the entries that do exist at that point.
After selecting the entry, it waits for SAP to respond and reads the status bar: an error (type E) or an abort (type A) makes the activity fail; any other message is logged.
Required parameters
Section titled “Required parameters”None on their own, but you must give selector or path.
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. |
selector | selector | — | Menu entry by id, for example wnd[0]/mbar/menu[0]/menu[2]. If present, it wins over path. |
path | string | — | Path of visible texts separated by >. E.g. "System > List > Save". Each level must match the entry’s full text (case-insensitive). Depends on the session language. |
timeout | number | — | Seconds to wait for the entry when using selector 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 |
|---|---|
Either 'selector' or 'path' is required. | You gave neither (or both are empty). |
There is no '…' entry in the menu. Available: …. Careful: the texts are in the logon language. | A level of path doesn’t exist. The message lists the entries that do exist at that level; check the spelling and the session language. |
The screen has no menu bar. | With path, the main window has no menu bar (for example, a dialog is in front). |
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. |
SAP replied [E …]: … | After the action, SAP showed an error (E) or an abort (A) in the status bar. The text is SAP’s. |
Plus the errors common to all activities.
Example
Section titled “Example”Save the list shown on screen using the menu, in a session logged on in English:
SAP — Select menu path = "System > List > Save > Local File"SAP — Save file dialog path = "C:\salidas\" fileName = "t000.txt" format = Text with TabsThe same entry by id:
SAP — Select menu selector = "wnd[0]/mbar/menu[3]/menu[1]/menu[1]/menu[2]"Related activities
Section titled “Related activities”- SAP — Press toolbar button — press a toolbar button.
- SAP — Send key — many menu entries have an equivalent function key.
- SAP — Save file dialog — complete the save dialog that some entries open.