输出与错误契约
本页由仓库原文构建生成。技术正文保留原文;版本要求、授权与限制以正文为准。
Output contract
Section titled “Output contract”Explicit global --format json also envelopes local maintenance and legacy
text results (legacy payloads use data.text). Every envelope has meta,
warnings and next_steps; errors include a classified error.category.
Usage errors are JSON on stderr in this mode. JSON configure requires explicit
flags rather than an interactive wizard. Debug serve remains a stream of
individual JSON envelopes, so its ready event is available immediately.
Default text/source behavior remains unchanged.
Every read command prints a JSON envelope (source commands print plain ABAP by default):
{ "ok": true, "format_version": 1, "command": "get-table", "profile": "dev", "object": {"type": "table", "name": "VBAK"}, "kind": "fields", "data": { }, "meta": {"row_count": 0} }Errors on stderr: { "ok": false, …, "error": {"code","message","http_status","hint"} }
(write-source failures add top-level data with the per-stage result).
| kind | commands | data shape |
|---|---|---|
source |
get-program/class/function-group/function/include/interface/cds-view/type-group, get-version-source, get-source, get-rap cds/bdef/srvd | {source, line_count}; get-source adds URI and one-based range metadata; default output = verbatim source |
fields |
get-table, get-structure | {fields:[{name,type,length,decimals,is_key,not_null}]} (S/4 DDL: length null for element refs, listed in meta.unparsed_types; no description key) |
objects |
search-object, get-package, where-used | {objects:[{name,type,uri,package,description}]}; where-used may add optional usage_line/usage_uri |
rows |
run-sql, odata-read —entity-set | {columns:[{name,type}], rows:[[…]]}; OData adds budgets, returned/limit_reached/truncated and non-followed pagination |
records |
list-transports, get-transport | list: {transports:[{trkorr,description,status,status_text,owner,target,tasks}]}; detail: {transport,objects} |
findings |
syntax-check, check-source, run-unit-test, run-atc | {findings:[{severity,text,line,uri}]}; candidate check adds status:passed/failed/unavailable, source URI/hash/reports; Unit adds test_classes, summary, evidence_gaps; alerts retain kind/details/stack |
dumps |
get-dump | {id,uri,detail_available,fallback,header,termination,sections,text,source,stack,evidence_gaps}; unsupported detail falls back to ST22 |
scalar |
get-type-info, get-transaction, create-object, get-definition, write-definition, delete-object, apply-change-set, get-function-signature, get-rap srvb, odata-read metadata | object dictionary; creation has plan/create/readback/outcome; binding has services/status/evidence_gaps |
capabilities |
discovery | {collections:[{href,title,content_types}]} (Atom discovery; use credentials doctor --coverage for the command matrix) |
feeds |
list-feeds, query-feed | {title,entries:[{id,title,summary,content_uri,links,schema}],next_uri}; schema only in catalog entries |
versions |
get-versions | {versions:[{version,is_active,content_uri,transports,history_uri,source_uri,part}],streams,evidence_gaps} |
diff |
diff-versions, transport diff | {comparison,diffs:[{from_uri,to_uri,changed,diff}],evidence_gaps}; transport adds request/object metadata |
debug |
debug primitives | {session,state,operation,evidence_gaps,...}; operation-specific evidence in references/debugging.md; foreground serve emits ready/final JSONL |
write |
write-source | {target,object,transport,baseline,content,plan_sha256,lock,candidate_check,part_creation,write,unlock,activation,outcome}; part-bound source URI and parent activation scope; stage status ∈ accepted/verified/failed/unknown/not_attempted/skipped; --dry-run adds diff; failures retain data |
execution |
run-class, run-report, run-abap, run-function | {plan,preparation,execution,output,cleanup,evidence_gaps}; wrappers add structured result; dry-run returns {plan} (snippets/wrappers also source); failures retain stage data; completed execution does not imply business success |
doctor --coverage“available” only guarantees the resource root exists — discovery omits sub-paths, HTTP methods and required content types. Sub-path moves, GET→POST and content-type mismatches are invisible to it and only real-machine fixture regression catches them.
Format selection: source defaults to text (byte-identical, safe to redirect),
every other kind defaults to json. Global -f/--format json|text|xml
or SAP_ADT_FORMAT (flag wins). --format xml returns the original ADT payload
(escape hatch for parsers). Empty results are still ok:true, row_count:0, exit 0.
Partial Unit/Dump/history/transport evidence is the exception: inspect meta.partial
and data.evidence_gaps even when ok:true; they exit 1. Aggregated history
and computed diffs have no raw XML representation. Debug output has no XML
representation; truncated evidence/unconfirmed cleanup exits 1 with meta.partial.
Full examples: references/examples.md.
Error codes and exit tiers
Section titled “Error codes and exit tiers”| Exit | Meaning | Codes |
|---|---|---|
| 0 | success, including empty results | — |
| 1 | operational (10 codes; incl. two release results) | CSRF_EXPIRED, SERVICE_NOT_ACTIVE, BAD_REQUEST, SERVER_ERROR, LOCKED_BY_OTHER, NETWORK_ERROR, PARSE_FAILED, RELEASE_UNVERIFIED, RELEASE_REJECTED, ACTIVATION_FAILED |
| 2 | configuration / credentials | CONFIG_MISSING, PROFILE_NOT_FOUND, AUTH_FAILED |
| 3 | policy refusal / operation did not happen, or write/execution state failed/unknown/partial — do not retry | WRITE_DISABLED, TRANSPORT_DISABLED, DEBUG_DISABLED, EXECUTE_DISABLED, EXECUTION_FAILED, EXECUTION_INCOMPLETE, CONFIRM_REQUIRED, USER_ABORTED, DML_REJECTED, BASELINE_CHANGED, CONTENT_CHANGED, WRITE_INCOMPLETE |
| 4 | requested object does not exist | OBJECT_NOT_FOUND |
All 26 codes. Execution errors may follow business side effects; never replay
automatically. RELEASE_UNVERIFIED = release sent, final status unknown
(readback timeout) — never re-release, verify in SE09/SE10; RELEASE_REJECTED
= still status D / check failed. BASELINE_CHANGED/CONTENT_CHANGED =
nothing written (re-run --dry-run, review the new diff); WRITE_INCOMPLETE
= write/readback/unlock/activation state unknown or partial — read data,
check the source and SM12, never retry or write the old source back;
ACTIVATION_FAILED = source written but not active (messages in data). Our errors are JSON envelopes on stderr;
Click usage errors are plain text (also exit 2 — distinguish by content).
OBJECT_NOT_FOUND needs a 404 ExceptionResourceNotFound body (404 “No
suitable resource” is BAD_REQUEST); non-CSRF 403 is AUTH_FAILED.