SAP — Press toolbar button
SAP — Press toolbar button
Section titled “SAP — Press toolbar button”Type: sap-press-toolbar-button · Package: SAP Activities v1.0.5
Presses a button on SAP’s toolbars: the standard toolbar (tbar[0]: Save, Back, Exit, Cancel…) or the application toolbar (tbar[1]: Execute and each transaction’s own buttons). It is the typical activity to run a report from its selection screen or to save what the flow has just entered.
How it works
Section titled “How it works”- It waits for SAP to finish processing and looks up the button by its selector, waiting for it to appear up to
timeout. - It presses it and waits for SAP to finish responding.
- It reads the status bar: a message of type E (error) or A (abort) makes the activity fail with SAP’s text; the rest (S, W, I) are written to the log.
Some common buttons:
| Selector | Button |
|---|---|
wnd[0]/tbar[1]/btn[8] | Execute (F8), on selection screens |
wnd[0]/tbar[0]/btn[11] | Save |
wnd[0]/tbar[0]/btn[3] | Back |
wnd[0]/tbar[0]/btn[15] | Exit |
wnd[0]/tbar[0]/btn[12] | Cancel |
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
selector | selector | — | Button to press, on tbar[0] or tbar[1]. Ex: "wnd[0]/tbar[1]/btn[8]". |
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. |
timeout | number | — | Seconds to wait for the button 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 |
|---|---|
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”Look up table T000 in SE16:
SAP Run Transaction code = "SE16"SAP Set Text selector = "wnd[0]/usr/ctxtDATABROWSE-TABLENAME" value = "T000"SAP Send Key key = EnterSAP Press Toolbar Button selector = "wnd[0]/tbar[1]/btn[8]"Related activities
Section titled “Related activities”- SAP — Press button — buttons inside the screen or a dialog.
- SAP — ALV toolbar — buttons on an ALV grid’s toolbar.
- SAP — Read status bar — check the result.