SAP — Set cell
SAP — Set cell
Section titled “SAP — Set cell”Type: sap-set-cell · Package: SAP Activities v1.0.5
Writes a value into a cell of an SAP table: a quantity on a purchase order item, a price, an indicator. It works with both kinds of table SAP has: ALV grids and classic tables (table control).
How it works
Section titled “How it works”Waits for SAP to finish whatever it is processing, finds the table by its selector and writes value into the cell given by row and column:
- ALV grid: the column is given by its technical name (for example
MENGE), and the row from 0. The grid must be in edit mode. - Classic table (table control): the column is given by its position, starting at 0, and the row also from 0. If you pass a column name, the activity fails with a message explaining it: names only work on an ALV grid.
Then it waits for SAP to respond and reads the status bar: if SAP shows an error (type E) or an abort (type A), the activity fails with that message; any other message is logged.
If the table is not on the screen yet, the activity waits for it up to the configured limit (timeout or the scope’s elementTimeout, 30 seconds by default).
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
selector | selector | — | The ALV grid or the classic table. Captured selector or SAP id. |
row | int | — | Row, starting at 0. On a classic table, the visible row. |
column | string | — | Technical column name (ALV) or its 0-based position (classic table), for example "MENGE" or "2". |
value | string | — | Value to write. |
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 table 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 |
|---|---|
'…' is not a column index. On a classic table control the column is its 0-based position (0, 1, 2...), not its name; column names only work on an ALV grid. | You passed a column name to a classic table. Use the position. |
There is no cell [row,column]. | The classic table has no cell at that visible row and column. Scroll the table or maximize the window. |
| SAP GUI error when modifying the cell | On an ALV: the column doesn’t exist, the row is out of range or the grid is not editable on that screen. |
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”In an editable ALV grid, change the quantity on the first row:
SAP — Set cell selector = "wnd[0]/usr/cntlGRID1/shellcont/shell" row = 0 column = "MENGE" value = "10"In a classic table, write into the third column of the second row:
SAP — Set cell selector = "wnd[0]/usr/tblZPROGTC_ITEMS" row = 1 column = "2" value = "10"Related activities
Section titled “Related activities”- SAP — Read table — read the table’s values.
- SAP — Select rows — select rows in an ALV grid.
- SAP — Maximize — enlarge the window so more rows are visible.
- SAP — Send key — confirm the changes with Enter.