Skip to content

SAP — Wait for element

Type: sap-wait-for-element  ·  Package: SAP Activities v1.0.5

Waits until an element appears on the SAP screen: a field on the next screen, a grid that takes a while to load, a pop-up dialog. If the element does not appear within the time limit, the activity fails.

Checks every 200 milliseconds whether the element given by selector exists in the session. Before each check it waits for SAP to finish whatever it is processing, so an element from the previous screen doesn’t count as found. As soon as it does, the flow continues. If the timeout (in seconds) passes without it appearing, the activity fails with a timeout error.

It only checks that the element exists; it does not read or change anything.

ParameterTypeDefaultDescription
selectorselector—Element to wait for. Captured selector or SAP id, for example wnd[1] for a pop-up dialog.
ParameterTypeDefaultDescription
sessionZoanSapSession—SAP session. Omit it inside the body of an SAP — Attach or SAP — Log on.
timeoutnumber—Seconds to wait. Empty: the scope’s elementTimeout (30 s unless changed). Decimals allowed, for example 2.5; with 0 it checks only once.

This activity does not return a value.

MessageCause and fix
Component '…' did not appear within … s.The element did not appear in time. Raise timeout if the screen is slow, or use SAP — Element exists if the element is optional.
'timeout' must be a number of seconds; got '…'.timeout is not a number or is negative.
'selector' is required.The selector arrived empty.

Plus the errors common to all activities.

Wait for the result grid of a heavy report, with more margin than usual:

SAP — Run transaction code = "ZREPORTE01"
SAP — Send key key = F8
SAP — Wait for element selector = "wnd[0]/usr/cntlGRID1/shellcont/shell" timeout = 120
SAP — Read table selector = "wnd[0]/usr/cntlGRID1/shellcont/shell" → output: rows