inspect Command Requirements
Overview
Inspect ABAP source file(s) for syntax errors and issues.
Command
# Inspect single file
abapgit-agent inspect --files src/zcl_my_class.clas.abap
# Inspect multiple files
abapgit-agent inspect --files src/zcl_my_class.clas.abap,src/zcl_other.clas.abap
# With Code Inspector variant (explicit)
abapgit-agent inspect --files src/zcl_my_class.clas.abap --variant ALL_CHECKS
# With no variant (uses default SAP standard checks)
abapgit-agent inspect --files src/zcl_my_class.clas.abap --variant EMPTY
# Without --variant: uses inspect.variant from .abapgit-agent.json if set, else system default
abapgit-agent inspect --files src/zcl_my_class.clas.abap
# Fetch documentation for a specific check finding
abapgit-agent inspect --doc CL_CI_TEST_EXCEPTION/UNHANDLED_01
Prerequisite
.abapGitAgentexists with valid credentials- Files must exist in the filesystem
Parameters
| Parameter | Required | Description |
|---|---|---|
--files |
Yes (unless --doc) |
Comma-separated list of files to inspect |
--variant |
No | Code Inspector variant name. Overrides inspect.variant in .abapgit-agent.json. |
--doc <class>/<code> |
No | Fetch SAP documentation for a specific check finding. Skips file inspection. |
Variant Resolution
The Code Inspector variant is resolved in this order:
--variantCLI flag (highest priority)inspect.variantin.abapgit-agent.json(project default)- System default (lowest priority)
Set the project default in .abapgit-agent.json so all developers and CI use the same variant without specifying it each time:
{
"inspect": {
"variant": "MY_VARIANT"
}
}
Excluding Objects
Add inspect.exclude to skip specific objects from inspection. Patterns match the object name (case-insensitive) and support * as a wildcard:
{
"inspect": {
"variant": "MY_VARIANT",
"exclude": ["zcl_generated_*", "zcl_legacy_helper"]
}
}
Excluded files are filtered before sending to the ABAP system — they are not checked at all.
Suppressing Specific Findings
To keep checking an object but downgrade specific errors/warnings to info (visible in output but won’t fail CI), use inspect.suppress:
{
"inspect": {
"variant": "MY_VARIANT",
"suppress": [
{ "object": "zcl_my_class", "message": "*pragma*" },
{ "object": "zcl_*_legacy", "message": "*obsolete statement*" }
]
}
}
object— object name pattern (*wildcard, case-insensitive)message— error/warning text pattern (*wildcard, case-insensitive)
Suppressed findings are moved to the info section with a [suppressed] prefix — they remain visible for tracking but don’t cause a non-zero exit code.
Tasks
1. Validate Parameters
--filesmust be specified- Files must exist
2. Load Configuration
Read .abapGitAgent for credentials
3. Fetch CSRF Token
GET /health (with X-CSRF-Token: fetch)
4. Make Inspect Request
Endpoint: POST /inspect
Request Body:
{
"files": ["ZCL_MY_CLASS.CLASS.ABAP"],
"variant": "ALL_CHECKS"
}
5. Display Results
Output
Success (No Errors)
Inspect for 1 file(s)
✅ CLAS ZCL_MY_CLASS - Syntax check passed
With Warnings
Inspect for 1 file(s)
⚠️ CLAS ZCL_MY_CLASS - Syntax check passed with warnings (2):
Warnings:
─────────────────────────────────────────────────────────────
Method: MY_METHOD
Line 000049:
Include: ZCL_MY_CLASS========CM002
The exception CX_DD_DDL_READ is not caught or declared in the RAISING clause of"MY_METHOD".
[CL_CI_TEST_EXCEPTION/UNHANDLED_01]
→ abapgit-agent inspect --doc CL_CI_TEST_EXCEPTION/UNHANDLED_01
Documentation Lookup (--doc)
abapgit-agent inspect --doc CL_CI_TEST_EXCEPTION/UNHANDLED_01
Output:
CL_CI_TEST_EXCEPTION/UNHANDLED_01
──────────────────────────────────
Unhandled exception
The exception ... is not caught or declared in the RAISING clause.
Correct this by handling the exception or adding it to the RAISING clause.
For checks with a suppression pseudo-comment, the full long text is shown:
abapgit-agent inspect --doc CL_CI_TEST_ITAB_PERFORMANCE/MESSAGEGM1
CL_CI_TEST_ITAB_PERFORMANCE/MESSAGEGM1
───────────────────────────────────────
Sequential Searches in Internal Tables
...
Message can be suppressed with pseudo comment "#EC CI_SORTSEQ
With Errors
Inspect for 1 file(s)
❌ CLAS ZCL_MY_CLASS - Syntax check failed (1 error(s)):
Errors:
─────────────────────────────────────────────────────────────
Method: MY_METHOD
Line 000021, Column 12:
Include: ZCL_MY_CLASS========CM002
Field "LV_VAR" is unknown
Response Structure
{
"success": "X",
"object_type": "CLAS",
"object_name": "ZCL_MY_CLASS",
"error_count": 2,
"errors": [
{
"line": "15",
"column": "10",
"text": "\"ZMYCLASS\" is not a type",
"word": "ZMYCLASS",
"sobjname": "ZCL_MY_CLASS========CM002",
"method_name": "MY_METHOD"
}
],
"warnings": [
{
"line": "49",
"message": "The exception CX_DD_DDL_READ is not caught...",
"sobjname": "ZCL_MY_CLASS========CM002",
"method_name": "MY_METHOD"
}
],
"infos": [
{
"line": "10",
"message": "Information message",
"sobjname": "ZCL_MY_CLASS========CM001",
"method_name": "CONSTRUCTOR"
}
]
}
Key Behaviors
- Multiple files in one request - All files are sent in a single API call
- CDS View validation - Uses
CL_DD_DDL_HANDLER_FACTORYto validate CDS views - Method name extraction - For classes, extracts method name from TMDIR based on include number (CM00X)
- Separate warnings and info - Warnings (‘W’) and Information (‘I’) are displayed in separate sections
- Sorted results - Errors, warnings, and info are sorted by method name and line number ascending
- Check ID and hint per finding - When
check_codeis available, each finding shows[check_class/check_code]and a→ abapgit-agent inspect --dochint --docmode - Fetches plain-text SAP documentation for a check finding from the ABAP backend (/sap/bc/z_abapgit_agent/insp_doc). Two sources are consulted: (1) KTD (cl_satc_ac_ui_ktd_docu) for the short message text, (2) DOKIL/DOCU_GET_FOR_F1HELP for the full long text including suppression pseudo-comments (e.g."#EC CI_SORTSEQ). DOKIL wins when it has content — it carries the complete documentation. The backend resolves the DOKIL key in priority order:CAper-message key (MCODE_<code>for numeric codes, direct for alphabetic),CAalternate-form key,CAclass-level0000fallback,HY/CHAPBC_SLIN<code>forCL_CI_TEST_EXTENDED_CHECKnumeric codes. All candidates are fetched in oneFOR ALL ENTRIESquery. ITF includes are resolved and inlined before returning plain text.
Error Handling
| Error | Message |
|---|---|
| File not found | File not found: <path> |
| Invalid file format | Invalid file format: <file> |
| No –files specified | Error: --files parameter required |
File Format
Same as pull command - files are parsed to extract object type and name:
| File | Object Type | Object Name |
|---|---|---|
zcl_my_class.clas.abap |
CLAS | ZCL_MY_CLASS |
zif_my_intf.intf.abap |
INTF | ZIF_MY_INTF |
Example
# Syntax check
abapgit-agent inspect --files src/zcl_my_class.clas.abap
# Multiple files
abapgit-agent inspect --files src/zcl_my_class.clas.abap,src/zcl_other.clas.abap
# With Code Inspector variant
abapgit-agent inspect --files src/zcl_my_class.clas.abap --variant ALL_CHECKS
# Look up docs for a finding shown in inspect output
abapgit-agent inspect --doc CL_CI_TEST_EXCEPTION/UNHANDLED_01
Use Case
Use inspect when:
- Pull shows “Error updating where-used list” (syntax error)
- You need detailed error messages with line numbers
- Debugging activation failures
abapgit-agent pull
❌ CLAS ZCL_MY_CLASS: Error updating where-used list
abapgit-agent inspect --files src/zcl_my_class.clas.abap
❌ CLAS ZCL_MY_CLASS - Syntax check failed (1 error(s)):
Method: MY_METHOD
Line 000021, Column 12:
Field "LV_VAR" is unknown