SAPRead
Reads SAP ABAP source code, metadata, table data, and syntax results to support code review, explanations, and pre-change analysis.
Instructions
Read SAP ABAP source, metadata and syntax results. For source purpose, explanations, specs, reviews or pre-change context, prefer SAPContext first. DDIC metadata: omit format (default text); structured is CLAS-only for ordinary reads. TABLE_QUERY: multi-column filters, data preview required; CDS needs SAP_BASIS 752+. TABLE_CONTENTS: single-column filter. INACTIVE_OBJECTS: no name. TABL/DTT: technical settings. SYNTAX: read-only SAP check (objectType+name, optional source for unsaved text). CLAS: method="*" for signatures, method="NAME" for one body, or grep. Global class declaration/implementation: MAIN (omit include). definitions/implementations contain local helpers.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | action="diff" NEW side (default "inactive" = pending unactivated changes). Same values as from. | |
| from | No | action="diff" OLD side: "active" (default), "inactive", a revision id from SAPRead(type="VERSIONS"), or a /sap/bc/adt/ revision URI. | |
| grep | No | Case-insensitive source regex: matching lines, 1-based numbers and ±3 context; invalid regex becomes literal. CLAS adds owning class/method; include scopes a section. Never combine with method. Works for source-bearing types (CLAS, INTF, DDLS, DCLS, BDEF, SRVD, SRVB, SKTD/KTD, DDLX, TABL, PROG, FUNC, FUGR, INCL, VIEW). | |
| name | No | Object name (e.g., ZTEST_PROGRAM, ZCL_ORDER, MARA) | |
| type | Yes | Repository or metadata type. TABL includes structures. KTD aliases SKTD; MESSAGES aliases MSAG. FTG2 aliases FEATURE_TOGGLE. SYNTAX requires objectType+name. Server-driven: discovery-gated XML metadata, AFF JSON source; DTSC/DSFD/DTDC/DRTY use DDL text. ENQU: JSON. TABL/DTI: TABLE~INDEX, prefers pending JSON. DESD external schema; EVTB/EVTO event binding/object; CSNM CSN model; COTA communication target; DTSC/DTDC static/dynamic cache; DSFD scalar function; UIAD launchpad descriptor; DRTY CDS type; APLO log object; SAJC/SAJT job catalog/template. | |
| group | No | Function group of the function module for FUNC, VERSIONS, or API_STATE with objectType=FUNC. Auto-resolved via SAPSearch if omitted. | |
| where | No | For TABLE_QUERY: structured WHERE conditions, ANDed together. Each item: {field, op, value?}. Ops: =, <>, <, <=, >, >=, LIKE, NOT LIKE, IN, NOT IN, IS NULL, IS NOT NULL; STARTS_WITH: literal prefix. Use <>; 758 rejects !=. IN/NOT IN: bare comma-separated values, e.g. "261,262". ARC-1 quotes/escapes them; no subqueries. Example: [{"field":"MATNR","op":"=","value":"300006888"},{"field":"BUDAT_MKPF","op":">=","value":"20250101"}]. | |
| action | No | Set to "diff" for a unified diff between two source versions (uses from/to) — cheaper than fetching both sources. Source types only: PROG, CLAS, INTF, FUNC, FUGR, INCL, DDLS, DCLS, BDEF, SRVD, DDLX, TABL. | |
| format | No | Default text; DEVC returns array then listing metadata, diff a patch. structured: CLAS metadata+includes, DEVC {objects,listing}, diff JSON. editable: fresh {source,sourceHash} for guarded SAPWrite; omit version/method/grep, select CLAS include. | |
| method | No | For CLAS: read a method (e.g., "get_name", "zif_order~process", "lhc_travel~accept") or use "*" to list methods. Without include=, lhc_*/lcl_* use implementations, ltc_* uses testclasses, and others use MAIN; explicit include= wins. For SOBJ: BOR method name to read. If omitted, returns the full BOR method catalog. Not used with other types. | |
| source | No | SYNTAX only: proposed source to check without saving. Omit to check stored version (default active; inactive checks draft). Object must exist; version=auto is unsupported. | |
| columns | No | For TABLE_QUERY: columns to SELECT (default: all). Example: ["MATNR","BWART","BUDAT","MENGE"]. | |
| include | No | TABL: indexes. CLAS: omit include or use main for global class; definitions/implementations are local helpers; macros/testclasses as named. Explicit include wins over method routing. DDLS: elements returns field catalog (keys, aliases, associations, types). VERSIONS CLAS: selects include history. BSP: case-sensitive path; name also accepts APP/path. TEXT_ELEMENTS: symbols|selections|headings; omit for pool (CLAS: symbols). | |
| lineEnd | No | Last source line (inclusive); requires lineStart. Clamped to the source end; a start beyond the source is an error. | |
| maxRows | No | Returned row cap for TABLE_CONTENTS/TABLE_QUERY (default 100, max 10,000; byte limit may apply sooner). | |
| toLabel | No | Diff NEW-side display label; does not change source resolution. | |
| version | No | Source defaults active; inactive requests a draft (SAP may return active if none); auto selects developer view. DTEL/ENQU/server-driven types default to developer view. Server-driven types return an error if SAP cannot confirm an explicit version (e.g. no draft). | |
| fromLabel | No | Diff OLD-side display label; does not change source resolution. | |
| lineStart | No | First source line (1-based, inclusive); requires lineEnd. Text reads only: CLAS, INTF, DDLS, DCLS, BDEF, SRVD, DDLX, TABL, PROG, FUNC, INCL. Supports CLAS include; incompatible with grep, method, diff, structured/editable output and signature/element extraction. | |
| sqlFilter | No | TABLE_CONTENTS condition expression only (no WHERE, no SELECT); broken on 758 (SAP expects SELECT). Use TABLE_QUERY where. | |
| maxResults | No | DEVC output cap: default 200, clamp 1–1000. Metadata reports possible truncation; total/completeness unknown. Direct mode does not cap SAP responses. | |
| objectType | No | DEVC direct: exact folder (CLAS/OC, TABL/DS). SYNTAX: required type (CLAS, PROG, DDLS). API_STATE: inferred. VERSIONS: endpoint type; inferred from CL_/IF_/CX_, else PROG. TEXT_ELEMENTS: PROG (default), CLAS or FUGR. | |
| versionUri | No | VERSION_SOURCE: canonical source/revision URI from VERSIONS .revisions[].uri; rejects unrelated ADT endpoints, absolute URLs, traversal, queries, and fragments. | |
| packageScope | No | DEVC direct contents, no recursion/descriptions (16 folders/2 MiB/10s). Omit for indexed search. | |
| force_refresh | No | For source reads: bypass cached source and inactive-list state before reading. Use when you know the object changed outside ARC-1. | |
| expand_includes | No | PROG/INCL/FUGR: add nested includes as "=== name ===" blocks; bounded, a closing note reports omissions. With grep: search all (FUGR: implied). No dynpros. | |
| includeSignature | No | FUNC: JSON {source,signature,processingType?,updateTaskKind?}. Signature and descriptions come from source. Default false: raw source. |