SAP — Set text
SAP — Set text
Section titled “SAP — Set text”Type: sap-set-text · Package: SAP Activities v1.0.5
Types a value into an SAP field: a table name, an order number, a date, a client. It is the activity you will use most to fill in selection screens and forms. It works with regular text fields, fields with a search help (the ones with the F4 button) and password fields.
How it works
Section titled “How it works”Waits for SAP to finish whatever it is processing, finds the field by its selector and replaces its content with value. It does not append text: whatever was in the field is replaced.
If the field is not on the screen yet, the activity waits for it up to the configured limit (the activity’s timeout or, if you leave it empty, the elementTimeout of SAP — Attach or SAP — Log on, 30 seconds by default). If the time runs out, the error states which program, screen (dynpro) and transaction the session is on, so you can quickly see whether SAP reached a different screen than expected.
The selector can be a selector captured with the Designer or the raw SAP id as text, for example wnd[0]/usr/ctxtDATABROWSE-TABLENAME.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
selector | selector | — | Field to fill in: text (txt), with search help (ctxt) or password (pwd). |
value | string | — | Text to type. If it is longer than the field, SAP truncates it to the field’s length. Empty clears the field. |
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 field 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 GUI error when setting the text | The element is not an editable field (for example, a label or a field that is read-only on that screen). Check the selector or the transaction mode. |
Plus the errors common to all activities.
Example
Section titled “Example”Query table T000 in transaction SE16:
SAP — Attach system = "A4H" client = "001" └─ body: SAP — Run transaction code = "SE16" SAP — Set text selector = "wnd[0]/usr/ctxtDATABROWSE-TABLENAME" value = "T000" SAP — Send key key = EnterRelated activities
Section titled “Related activities”- SAP — Get text — read the content of a field or label.
- SAP — Send key — confirm with Enter or execute with F8.
- SAP — Select from dropdown — for fields that are dropdown lists.
- SAP — Set checkbox — for checkboxes.