Skip to content

SAP — Get text

Type: sap-get-text  ·  Package: SAP Activities v1.0.5  ·  Output: string

Reads the text of an SAP element: a field’s value, a label, a window title. It is the way to bring into your flow a piece of data SAP shows on screen —a document number, a name, a status— to store it, compare it or send it to another system.

It waits for SAP to finish processing, looks up the element by its selector (waiting for it to appear, up to timeout) and returns its text exactly as SAP shows it. If the element has no text, it returns an empty string.

If the element doesn’t appear in time, it fails and tells you which screen the session is on.

ParameterTypeDefaultDescription
selectorselector—Element to read. Ex: "wnd[0]/usr/txtRSYST-BNAME" or "wnd[0]/titl" (window title).
ParameterTypeDefaultDescription
sessionZoanSapSession—SAP session. Omit it inside the body of an SAP — Attach or SAP — Log on.
timeoutnumber—Seconds to wait for the element to appear. Overrides the scope’s elementTimeout. Empty uses the scope value (30 by default); 0 fails on the first try. Decimals allowed.

Returns a string with the element’s text, as SAP shows it (spaces are not trimmed). If the element has no text, or is of a type without a text property, it returns "".

MessageCause 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.

Plus the errors common to all activities.

SAP Run Transaction code = "SE16"
SAP Get Text selector = "wnd[0]/titl" → output: title
Log message = "Current screen: " + title