Skip to content

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.

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

None.

ParameterTypeDefaultDescription
sessionZoanSapSession—SAP session. Omit it inside the body of an SAP — Attach or SAP — Log on.
areastring"wnd[0]/usr"Container to read (SAP id).
maxRowsint500Maximum rows to return.

Returns a List<Dictionary<string,object>>: a list of rows, ordered top to bottom, where each row is a dictionary with:

KeyTypeContent
rowintRow number on the screen grid (SAP’s vertical coordinate, not a 0-based counter).
cellsListThe row’s texts, left to right, trimmed.
textstringThe 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.

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

SAP Run Transaction code = "SE16"
SAP Set Text selector = "wnd[0]/usr/ctxtDATABROWSE-TABLENAME" value = "T000"
SAP Send Key key = Enter
SAP Press Toolbar Button selector = "wnd[0]/tbar[1]/btn[8]"
SAP Read Classic List maxRows = 100 → output: lines
For Each items = lines itemVariable = line
└─ activities:
Log message = str(line["text"])