SAP — Close modal
SAP — Close modal
Section titled “SAP — Close modal”Type: sap-close-modal · Package: SAP Activities v1.0.5 · Output: boolean
Closes an SAP modal window: a dialog that opens on top of the main screen and blocks it, such as the system messages shown at logon. If none is open, it does nothing and doesn’t fail, so you can place it “just in case” wherever a dialog sometimes appears and sometimes doesn’t.
How it works
Section titled “How it works”It waits for SAP to finish whatever it is processing and looks for the window given in window (by default wnd[1], the first modal). If it exists, it closes it, as with the window’s X: it doesn’t press any of its buttons or accept its content. If it doesn’t exist, it notes that in the log and goes on.
It returns true if it closed a window and false if there was none, in case you want to know whether the dialog appeared.
Required parameters
Section titled “Required parameters”None.
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. |
window | string | "wnd[1]" | Window to close. Use wnd[2] when one dialog sits on top of another. |
Output
Section titled “Output”Returns a boolean: true if there was a modal window and it closed it, false if there was none. The log shows Window … closed. or There was no window ….
Common errors
Section titled “Common errors”No window is not an error: the activity returns false. It can only fail with the errors common to all activities, such as a missing session.
Example
Section titled “Example”Close the system messages that may appear right after logon:
SAP Logon connection = "DEVELOP" client = "001" user = credential("sap-dev")["user"] password = credential("sap-dev") └─ body: SAP Close Modal SAP Run Transaction code = "SE16"Record whether the dialog showed up at all:
SAP Close Modal → output: hadDialogIf condition = hadDialog └─ then: Log level = warning message = "SAP showed a dialog and it was closed"Related activities
Section titled “Related activities”- SAP — Log on — leaves open the dialogs it doesn’t recognize.
- SAP — Press button — press a specific button of the dialog.
- SAP — Element exists — find out whether a dialog is open.