Skip to content

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

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

ParameterTypeDefaultDescription
selectorselector—The ALV grid or the classic table. Captured selector or SAP id.
rowint—Row, starting at 0. On a classic table, the visible row.
columnstring—Technical column name (ALV) or its 0-based position (classic table), for example "MENGE" or "2".
valuestring—Value to write.
ParameterTypeDefaultDescription
sessionZoanSapSession—SAP session. Omit it inside the body of an SAP — Attach or SAP — Log on.
timeoutnumber—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.

This activity does not return a value.

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

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"