SAP — ALV toolbar
SAP — ALV toolbar
Section titled “SAP — ALV toolbar”Type: sap-grid-toolbar · Package: SAP Activities v1.0.5 · Output: List<string>
Presses a button on an ALV grid’s toolbar: the small toolbar attached to the grid (filter, sort, totals, change layout…). Each program puts its own buttons there, so the activity also helps you discover them: if you leave button empty, instead of pressing it returns the list of buttons that ALV has.
How it works
Section titled “How it works”It waits for SAP to finish processing and looks up the ALV by its selector, waiting for it to appear up to timeout. Then:
- With
button: it presses the button with that code and waits for SAP to respond. Then it reads the status bar: a message of type E or A makes the activity fail; the rest are written to the log. - Without
button: it presses nothing. It returns a list with one text per button, formatted ascode · text(for example&FIND · Find).
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
selector | selector | — | The ALV grid. Ex: "wnd[0]/usr/cntlGRID1/shellcont/shell". |
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. |
button | string | — | Button code (&SORT_ASC, &FIND…). Empty: returns the available buttons instead of pressing. Menu buttons (&MB_…) open a menu instead of running an action; to export use SAP — Export ALV grid. |
timeout | number | — | Seconds to wait for the ALV grid 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”Without button, returns a List<string> with the ALV’s buttons, one per item and in toolbar order, formatted as code · text (for example &FIND · Find; the text may be empty for icon-only buttons). If the ALV has no buttons, the list is empty.
When pressing a button it does not return a value.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
| SAP GUI error when pressing the button | The ALV has no button with that code. List the ones it does have by leaving button empty. |
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”First, discover which buttons the ALV has (once, while building the flow):
SAP ALV Toolbar selector = "wnd[0]/usr/cntlGRID1/shellcont/shell" → output: buttonsLog message = string.Join(" | ", buttons)Then press the one you need:
SAP ALV Toolbar selector = "wnd[0]/usr/cntlGRID1/shellcont/shell" button = "&SORT_ASC"Related activities
Section titled “Related activities”- SAP — Export ALV grid — export the ALV from its menu.
- SAP — Read table — read the ALV’s content.
- SAP — Press toolbar button — buttons on the window’s toolbars.