SAP — Read classic list
SAP — Read classic list
Section titled “SAP — Read classic list”Type: sap-read-list · Package: SAP Activities v1.0.5 · Output: List<Dictionary<string,object>>
Reads an SAP classic list: the output of traditional reports, which is neither a table nor an ALV but text laid out on a character grid (like the one SE16 shows with its default settings). The activity rebuilds those lines and hands them to you as rows, so you can look for a value or loop through them.
How it works
Section titled “How it works”It walks the container given in area (by default the work area, wnd[0]/usr) and gathers every element placed by character coordinate —the ones SAP identifies as lbl[column,row]—. It groups them by row, sorts them by column and discards empty ones. It returns at most maxRows rows, in order.
It reads what the screen has loaded at that moment. If the container doesn’t exist, it fails (it doesn’t wait for it to appear).
Required parameters
Section titled “Required parameters”None.
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. |
area | string | "wnd[0]/usr" | Container to read (SAP id). |
maxRows | int | 500 | Maximum rows to return. |
Output
Section titled “Output”Returns a List<Dictionary<string,object>>: a list of rows, ordered top to bottom, where each row is a dictionary with:
| Key | Type | Content |
|---|---|---|
row | int | Row number on the screen grid (SAP’s vertical coordinate, not a 0-based counter). |
cells | List | The row’s texts, left to right, trimmed. |
text | string | The row’s texts joined with a space. |
[ { "row": 3, "cells": ["001", "Test client", "Sample City"], "text": "001 Test client Sample City" }, ...]Rows with no text at all don’t appear. If the screen has no elements placed by coordinate, it returns an empty list.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
Component '…' does not exist. | The area container is not on the screen. The activity does not wait for it to appear: wait first with SAP — Wait for element. |
Plus the errors common to all activities.
Example
Section titled “Example”SAP Run Transaction code = "SE16"SAP Set Text selector = "wnd[0]/usr/ctxtDATABROWSE-TABLENAME" value = "T000"SAP Send Key key = EnterSAP Press Toolbar Button selector = "wnd[0]/tbar[1]/btn[8]"SAP Read Classic List maxRows = 100 → output: linesFor Each items = lines itemVariable = line └─ activities: Log message = str(line["text"])Related activities
Section titled “Related activities”- SAP — Export list — export the whole list to a file.
- SAP — Read table — for ALV grids and classic tables.
- SAP — Get text — read a single line or label.