Sap Read Table
sap_read_tableRead rows from an ALV grid or TableControl on the current SAP screen, auto-detecting the table type. Fetch specific columns, discover column metadata, and paginate large tables.
Instructions
Read rows from a table on the current screen — ALV grid (report/list output) or TableControl (SM30 maintenance view, customizing screens).
Auto-detects the table type. The response includes a 'table_type' field ('GuiGridView' for ALV or 'GuiTableControl') so you know which type-specific tools to use next (e.g., sap_get_alv_toolbar for ALV, sap_scroll_table_control for TableControl).
Use columns_only=true for schema discovery (returns column metadata only, no data). For a TableControl it also gives each column's cell_type and a cell_id template ({row} = zero-based visible row) for sap_set_batch_fields. Use columns to fetch only specific columns (CSV). Use start_row to paginate through large tables. On a TableControl a start_row (0 included) scrolls there first; without one the read starts where the table is scrolled now (e.g. after Position...). first_visible_row says which row is on top.
A TableControl read returns at most the visible rows: page with start_row=next_start_row while has_more is true. start_row_note explains a clamped or failed scroll. total_rows counts its empty lines too (SM30 pads the view). When the read reaches the first empty row with no data below it, the response has empty_rows_from, that row's absolute index: the data ends there.
What could not be read is said, never dropped: a column name the table does not have is listed in unknown_columns (no known name at all: an error with the table's column names); a cell that could not be read is null (an empty cell is ""), listed in unreadable_cells (ALV) or, for a whole table-control row, unreadable_rows; warning sums it up.
An ALV grid read also gives, when set: title (which list this is) and the selection that toolbar and menu functions act on: selected_rows in SAP's form ("1,2,4-8,10") with selected_row_count, selected_cells, selected_columns.
An ALV grid whose layout has totals lines (totals, subtotals) has totals_lines, and each such row carries _total_level: 1 is the innermost subtotal, totals_lines.highest_level the overall total. It is a sum, not a record, and total_rows counts it. _collapsed: true marks a subtotal whose group is closed: its records are not in the grid.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"table_id": "<table_id>"
},
"name": "sap_read_table"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| columns | No | ||
| max_rows | No | ||
| table_id | Yes | ||
| start_row | No | ||
| columns_only | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||