v1.1.0 · 303 rules · 8 skills · EN + PT

Make your AI write ABAP that actually activates.

Ready-made rules for Cursor, Claude Code, GitHub Copilot, Windsurf and any AGENTS.md agent, written by an ABAP developer and checked against SAP's own documentation.

✗ Typical AI output
SELECT * FROM vbak INTO TABLE lt_vbak FOR ALL ENTRIES IN lt_keys " empty? reads ALL rows WHERE vbeln = lt_keys-vbeln. CALL FUNCTION 'Z_GET_ORDER_STATUS' " invented FM EXPORTING iv_vbeln = lv_vbeln. COMMIT WORK. " inside a RAP handler
✓ With ABAP for Agents
IF keys IS NOT INITIAL. SELECT vbeln, erdat, gbstk " S/4: status in VBAK FROM vbak FOR ALL ENTRIES IN @keys WHERE vbeln = @keys-vbeln INTO TABLE @DATA(orders). " 7.40 SP08+ ENDIF. " No COMMIT in RAP: the framework owns the LUW.

The problem: LLMs are confident and wrong in ABAP

Invented objects

Function modules, BAPIs and CDS views that don't exist or aren't released for ABAP Cloud.

Wrong release

INTO TABLE @DATA(...) on 7.40 SP05, += on 7.50, define view instead of view entities.

Silent data bugs

FOR ALL ENTRIES on an empty table reads the whole table. SELECT SINGLE without the full key.

RAP & cloud breakers

COMMIT WORK in behavior pools, sy-datum and WRITE in ABAP Cloud.

What's inside

303 rules across 20 topics + 8 agent skills

Each rule is one short, checkable instruction (a do/don't, a release fact or an obsolete statement with its replacement), not an essay. In English and Portuguese, for every major AI coding tool.

The 20 rule topics

Foundations

  • 00-coreCore guardrails also in lite
    Pin down release and language version first, never invent SAP objects, Clean ABAP defaults, read-only MCP use. Always on.
  • 10-release-syntaxSyntax by release also in lite
    Which syntax exists where, from 7.40 SP02 to 7.55, so 7.40/7.50 code gets no newer syntax.
  • 50-clean-abapClean ABAP
    High-signal rules from SAP's styleguide that models break most: signatures, booleans, exceptions, tables.
  • 55-error-handlingError handling
    Exception classes with T100 message texts, keeping previous, RAP messages, application log.
  • 60-obsoleteObsolete statements also in lite
    15 legacy statements an AI must not generate, each with its modern replacement.
  • 90-llm-pitfallsLLM self-check also in lite
    10 checks the agent runs before answering: invented FMs, BAPI RETURN handling, mixed releases. Always on.

Data, performance and transactions

  • 20-abap-sqlABAP SQL also in lite
    Strict mode and @ escaping, the FOR ALL ENTRIES empty-table trap, basic performance patterns.
  • 25-performancePerformance
    Measure first (ST05, SAT), no SELECT or EML in loops, mass changes, table buffer, internal tables.
  • 46-amdpAMDP and code pushdown
    When AMDP is really needed, SQLScript method rules, client handling, ABAP Cloud limits.
  • 65-luw-locksSAP LUW, locks and update tasks
    One COMMIT WORK per SAP LUW, update function modules, lock objects, controlled SAP LUW, bgPF.
  • 67-bapis-apisBAPIs, RFC and released APIs
    Released APIs first, BAPI RETURN and commit handling, X flag structures, RFC exceptions.

ABAP Cloud, clean core and security

  • 30-abap-cloudABAP Cloud & clean core
    Released APIs only, cloud replacements for sy-datum, WRITE and classic FMs, clean core levels A–D.
  • 35-clean-core-extensibilityClean core extensibility
    Key user, developer or side-by-side extensibility, release contracts C0–C4, BAdIs, custom fields.
  • 27-securitySecurity
    AUTHORITY-CHECK (ABAP SQL checks nothing), CDS access control, SQL injection, XSS, no hard-coded secrets.

RAP, CDS and Fiori

  • 40-rap-cdsRAP & CDS
    View entities, BDEF strict mode, behavior pools without COMMIT WORK, EML done right.
  • 42-cds-advancedAdvanced CDS
    Cardinality, parameters and session variables, amounts and quantities, table functions, custom entities.
  • 44-odata-fioriOData and Fiori Elements
    Service definition and binding, OData V4 vs V2, transportable publishing, metadata extensions, UI annotations.

Testing and S/4HANA

  • 70-abap-unitABAP Unit
    Test classes, asserts and test doubles that really isolate the database and dependencies.
  • 80-s4-vs-eccS/4HANA vs ECC
    MATDOC, ACDOCA, Business Partner, 40-character MATNR and other data model changes that break code.
  • 85-s4-migrationECC → S/4HANA code migration
    Scoping (SCMON/SUSG), ATC readiness checks, simplification items and their SAP Notes, typical fixes.

The 8 agent skills

  • abap-rap-bo
    Create a managed RAP business object step by step: CDS view entities, BDEF, behavior pool, projection, service.
  • abap-cds-view
    Create or review a CDS view entity with associations, parameters, semantics, access control and UI metadata.
  • abap-odata-service
    Expose CDS or a RAP BO as an OData service: definition, binding, publishing, Fiori Elements annotations.
  • abap-refactor-legacy
    Refactor a legacy report or function module to Clean ABAP in small, behaviour-preserving steps.
  • abap-unit-tests
    Write ABAP Unit tests with test doubles for the database, CDS and other dependencies.
  • abap-performance-review
    Review code for database and internal table performance, with prioritized findings and fixes.
  • abap-s4-migration
    Plan and fix custom code for an ECC → S/4HANA conversion, from usage scoping and ATC checks to fixes per simplification item.
  • abap-clean-core-review also in lite
    Review code for Clean ABAP, ABAP Cloud readiness and clean core level A–D, with a prioritized findings table.

Also in the box

Every tool, one source

Cursor .mdc rules, Copilot instructions + prompt files, Windsurf rules + workflows and Claude Code skills, each with all 20 topics. AGENTS.md + the abap-rules/ folder for Claude Code, Codex and other agents. Plain prompts for ChatGPT / Joule chat.

Short on purpose

Research shows bloated context files hurt agents. AGENTS.md keeps the 10 core topics inline (about 210 lines) and points to the other 10 in abap-rules/, read on demand. Tool rules load by file type.

Sources included

Each rule maps to the Clean ABAP styleguide, the ABAP Keyword Documentation, SAP cheat sheets or the Cloudification Repository.

Generator included

Add your house rules (prefixes, namespaces, allowed BAPIs) and rebuild every format with one command.

What the 19 € pack catches that lite does not

Three mistakes AI assistants make in ABAP, each covered by a rule that is only in the paid pack. For each: the real rule text, what an assistant typically writes, and what it writes with the rule loaded. The FOR ALL ENTRIES guard is also in the free lite edition. These three are not.

BSEG and ACDOCA instead of released CDS views

Rule text from the pack (verbatim)
  • Finance: the Universal Journal ACDOCA is the line-item source of truth in S/4HANA Finance. Old totals/index tables are compatibility views; do not write to them.
  • Prefer released CDS views over table access. They abstract these changes and are the clean-core path.
  • Data model changes (see the S/4 vs ECC rules): VBUK / VBUP status reads, KONV, BSEG access patterns, MKPF / MSEG. Switch to the new tables, compatibility views (read only) or released CDS views as the note says.
  • No direct reads of SAP tables (MARA, VBAK, ...). Use released CDS views (typically I_* interface views) after confirming they are released.
✗ Typical AI output
SELECT bukrs, belnr, gjahr, buzei, dmbtr FROM bseg INTO TABLE @DATA(lt_items) WHERE bukrs = @lv_bukrs AND belnr = @lv_belnr AND gjahr = @lv_gjahr.
✓ With the pack (illustration)
" Confirm the released successor in ADT / the Cloudification Repository. " I_JournalEntryItem is one row per ledger: filter the leading ledger " (0L in SAP's standard setup) or totals multiply. SELECT companycode, accountingdocument, fiscalyear, ledgergllineitem, amountincompanycodecurrency FROM i_journalentryitem WHERE companycode = @lv_bukrs AND accountingdocument = @lv_belnr AND fiscalyear = @lv_gjahr AND ledger = '0L' INTO TABLE @DATA(lt_items).

Illustration, not a quote from the pack. The pack tells the agent to use released CDS views instead of reading BSEG or ACDOCA directly. It does not name I_JournalEntryItem or the 0L ledger: those come from our free guide on replacing BSEG. Check view and field names in your release before you rely on them. Guide: replacing SELECT on BSEG →

Lite does not mention BSEG, ACDOCA or released finance CDS views.

RAP: COMMIT WORK inside a behavior pool

Rule text from the pack (verbatim)
  • Never use COMMIT WORK, ROLLBACK WORK, COMMIT ENTITIES or ROLLBACK ENTITIES inside handler or saver methods. RAP owns the LUW.
  • Behavior pool: implement only the methods the BDEF declares. Report errors via failed / reported with %tky. No COMMIT/ROLLBACK statements. Use READ ENTITIES ... IN LOCAL MODE.
✗ Typical AI output
METHOD modify_status. MODIFY ENTITIES OF zr_order ENTITY order UPDATE FIELDS ( status ) WITH lt_update. COMMIT WORK. " RAP owns the LUW: this must not be here ENDMETHOD.
✓ With the pack
METHOD modify_status. MODIFY ENTITIES OF zr_order ENTITY order UPDATE FIELDS ( status ) WITH lt_update. " No COMMIT / ROLLBACK in a handler. Report errors via failed / reported " with %tky. The RAP runtime commits. ENDMETHOD.

Illustration, not pack text.

Lite has no RAP or EML rules. COMMIT WORK in a behavior pool is a paid-rule catch.

ABAP SQL without AUTHORITY-CHECK

Rule text from the pack (verbatim)
  • ABAP SQL performs no authorization checks. Before reading or changing business data in classic ABAP, check with AUTHORITY-CHECK OBJECT 'obj' ID 'field' FIELD value ... (up to 10 fields; DUMMY only for fields you deliberately skip).
  • Evaluate sy-subrc: 0 = authorized, 4 = not authorized, 12 = no authorization for the object, 40 = invalid user (with FOR USER). Treat everything except 0 as "deny".
  • Do not invent authorization objects or field names. Ask for them, or tell the user to look them up (SU21). In ABAP Cloud the object must be given as a literal.
✗ Typical AI output
SELECT kunnr, name1, ktokd FROM kna1 WHERE kunnr = @lv_kunnr INTO @DATA(ls_customer).
✓ With the pack
" Use the real object and fields from SU21. Do not invent names. AUTHORITY-CHECK OBJECT 'obj' ID 'field' FIELD value. IF sy-subrc <> 0. RETURN. " anything except 0 = deny ENDIF. SELECT kunnr, name1, ktokd FROM kna1 WHERE kunnr = @lv_kunnr INTO @DATA(ls_customer).

Illustration, not pack text.

Lite has no security topic. ABAP SQL happily returns rows the user is not allowed to see.

A real rule from the pack: 80-s4-vs-ecc

# S/4HANA vs ECC (check the release-specific Simplification List) - **Inventory**: material documents live in `MATDOC`. `MKPF` / `MSEG` (and aggregate stock tables) are served by compatibility views. Never write to them, and prefer released CDS views or `MATDOC` for reads. - **Sales status**: `VBUK` / `VBUP` no longer exist as separate status tables. Status fields moved into the document tables (`VBAK` / `VBAP`, `LIKP` / `LIPS`, `VBRK`). Do not join VBUK in S/4 code. - **Business Partner**: the BP (with Customer-Vendor Integration, CVI) is mandatory. Create and change customers and suppliers through BP APIs, not by writing `KNA1` / `LFA1`. - **Material number**: `MATNR` can be up to 40 characters. Never hard-code length 18 or offsets. Type with the data element, and convert with `ALPHA` formatting or released conversion APIs. - **Finance**: the Universal Journal `ACDOCA` is the line-item source of truth in S/4HANA Finance. Old totals/index tables are compatibility views; do not write to them. - **Pricing**: condition records of documents are stored in `PRCD_ELEMENTS`, not `KONV` (KONV remains a structure; `V_KONV_CDS` is a read-only fallback). Never update them directly. - Prefer **released CDS views** over table access. They abstract these changes and are the clean-core path. - If the user says "ECC", none of the above applies: there are no CDS view entities, no RAP, and classic tables are correct.

Verbatim from the v1.1.0 pack (S/4HANA vs ECC data model). Paid only, not in lite.

A real agent skill: abap-rap-bo

3. BDEF: `managed implementation in class zbp_r_<entity> unique; strict ( 2 );` (`strict ( 2 )` from 7.57, `strict` from 7.56) (+ `with draft;` if required), with persistent table, lock master, `authorization master ( instance )`, ETag, field controls (`readonly`, `mandatory`), numbering, and determinations/validations/actions as requested. 4. Behavior pool: implement only the methods the BDEF declares. Report errors via `failed` / `reported` with `%tky`. **No COMMIT/ROLLBACK statements.** Use `READ ENTITIES ... IN LOCAL MODE`. **Do not:** invent annotations, use `define view`, add `sqlViewName`, or call non-released APIs in ABAP Cloud.

Verbatim excerpt (steps 3 and 4 and the closing line). One of 8 skills. Lite has only abap-clean-core-review.

What you download: the v1.1.0 ZIP

abap-for-agents-rules-pack-v1.1.0.zip (285 files) ├── README.md README.pt.md CHANGELOG.md LICENSE.md SOURCES.md VERSION build.py ├── source/ │ ├── rules/en/ (20 topic files) │ │ ├── 00-core.md ├── 44-odata-fiori.md │ │ ├── 10-release-syntax.md ├── 46-amdp.md │ │ ├── 20-abap-sql.md ├── 50-clean-abap.md │ │ ├── 25-performance.md ├── 55-error-handling.md │ │ ├── 27-security.md ├── 60-obsolete.md │ │ ├── 30-abap-cloud.md ├── 65-luw-locks.md │ │ ├── 35-clean-core-extensibility.md├── 67-bapis-apis.md │ │ ├── 40-rap-cds.md ├── 70-abap-unit.md │ │ ├── 42-cds-advanced.md ├── 80-s4-vs-ecc.md │ │ │ ├── 85-s4-migration.md │ │ │ └── 90-llm-pitfalls.md │ ├── rules/pt/ (same 20 filenames, Portuguese) │ ├── skills/en/ │ │ ├── abap-cds-view.md ├── abap-refactor-legacy.md │ │ ├── abap-clean-core-review.md ├── abap-s4-migration.md │ │ ├── abap-odata-service.md ├── abap-unit-tests.md │ │ ├── abap-performance-review.md └── abap-rap-bo.md │ └── skills/pt/ (same 8 filenames, Portuguese) └── dist/ ├── en/ (ready to copy into a project) │ ├── AGENTS.md CLAUDE.md │ ├── abap-rules/ (10 v1.1 topic files, read on demand) │ ├── .claude/skills/ (8 skills, each .../SKILL.md) │ ├── .cursor/rules/ (20 topic rules + 8 task-*.mdc) │ ├── .github/ copilot-instructions.md, instructions/ (18), prompts/ (8) │ ├── .windsurf/ rules/ (20), workflows/ (8) │ └── prompts/ (8 plain prompts) └── pt/ (same layout, Portuguese)

285 files, English and Portuguese, every tool format, plus the generator and SOURCES.md. Folder and file names are real; tool folders are collapsed.

Pricing

ABAP for Agents Rules Pack

19 €
One-time payment · 19 € · less than 15 minutes of consulting · free v1.x updates
  • Version 1.1: 303 rules in all 20 topics
  • All 8 agent skills (RAP BO, CDS view, OData service, legacy refactor, ABAP Unit, performance review, S/4HANA migration, clean core review)
  • English and Portuguese
  • Cursor, Claude Code, Copilot, Windsurf, Codex, AGENTS.md
  • Generator for your house rules + SOURCES.md
  • Free updates
Get the pack: 19 €

Use it in unlimited own and client projects. You just can't resell or republish the pack.

Checkout is handled by Lemon Squeezy. You get a VAT invoice. At checkout you can enter your company name and tax ID / NIF so the invoice is valid as a company expense. VAT is added when it applies in your country.

What's new in v1.1.0 (changelog)

Free lite (MIT)

0 €
  • 5 of the 20 topics (about 70 rules)
  • 1 skill: clean core review
  • EN + PT, all tool formats
  • Public GitHub repo
Download lite GitHub

Who writes this

These rules are written by an ABAP developer who works on ECC and S/4HANA systems, including custom-code migrations, and on internal APIs and tools. Every rule is checked against SAP's own documentation (ABAP Keyword Documentation, the Clean ABAP styleguide, SAP Help and the Cloudification Repository), and the sources are included in the pack. Independent product, not affiliated with SAP SE. The brand is anonymous on purpose: the work is in the rules, not in a personal profile.

Free lite vs Rules Pack

Free liteRules Pack
Rulesabout 70303
Topics5: core, release syntax, ABAP SQL, obsolete statements, LLM self-checkall 20, adds performance, security, ABAP Cloud & clean core extensibility, RAP, CDS, OData & Fiori, AMDP, error handling, LUW & locks, BAPIs, Clean ABAP, ABAP Unit, S/4HANA vs ECC and migration
Agent skills1: clean core review8: + RAP BO, CDS view, OData service, legacy refactor, ABAP Unit tests, performance review, S/4HANA migration
Tool formatsallall
LanguagesEN + PTEN + PT
Generator for house rules–✓
Source per rule (SOURCES.md)–✓
LicenseMITunlimited own and client projects
Updateson GitHubfree v1.x updates

Guides

Practical, source-backed guides on getting AI assistants to write correct ABAP.

ABAP mistakes AI coding assistants make, and how to prevent them

The pillar guide. Nine repeat mistakes, why models make them, and the rule or code pattern that prevents each one.

FOR ALL ENTRIES with an empty table: the trap and the fix

Why an empty driver table reads the whole database table, the one-line guard, the silent duplicate-row trap, and the alternatives.

Cursor rules for SAP ABAP: a setup guide

Project rules in .cursor/rules for ABAP: rule types, glob patterns for abapGit and ADT files, an always-on core rule and a quick test.

Using Claude Code and AGENTS.md with SAP ABAP

One AGENTS.md for every agent, a CLAUDE.md that imports it, an on-demand review skill, and how to check that Claude Code loaded them.

GitHub Copilot custom instructions for ABAP

copilot-instructions.md for the core rules, applyTo-scoped instruction files for ABAP sources, a review prompt file, and where each one works.

SAP's ADT MCP server with Claude Code, GitHub Copilot and Codex

What SAP's ADT MCP server in ABAP development tools for VS Code is, how to connect Claude Code, Copilot and Codex, and a read-only-first setup.

Column totals in a Fiori Elements List Report with RAP and CDS

How to get a totals row in an OData V4 List Report from RAP: the two CDS annotations, currencies and units, the table type, and what to check when the sum doesn't show.

Replacing SELECT on BSEG in S/4HANA: ACDOCA, I_JournalEntryItem and I_OperationalAcctgDocItem

Why the ATC flags reads on BSEG in S/4HANA, what BSEG still holds, when to move to I_JournalEntryItem or I_OperationalAcctgDocItem, the ledger trap and when an exemption is the right answer.

Extracting data from SAP S/4HANA Cloud with released CDS views

How SAP S/4HANA Cloud exposes data for extraction: C1-released CDS views with @Analytics.dataExtraction, the CDS_EXTRACTION route into Datasphere, key views and the A_ OData API limits.

How to check if a CDS view is released and extraction-enabled in your S/4HANA Cloud tenant

How to verify in your own S/4HANA Cloud tenant that a CDS view is C1-released and extraction-enabled: what the Accelerator Hub can tell you, View Browser, I_DataExtractionEnabledView, the allowlist, and the load test.

All guides →

Get notified about updates

New rules when SAP or the AI tools change: about one short email a month. No spam.

We'll send you a confirmation email first (double opt-in); you're only subscribed after you click the link. Unsubscribe anytime with one click. Emails are sent via Kit.

FAQ

Does this work with SAP Joule?

The rules target Cursor, Claude Code, GitHub Copilot, Windsurf and AGENTS.md agents. For Joule chat, use the included plain prompts. SAP does not document whether Joule reads rule files.

Does it work with ECC, or only S/4HANA and ABAP Cloud?

Both. The core rule makes the agent establish product, release and language version first, and the release table keeps 7.40/7.50 code free of newer syntax.

Can the AI still ignore the rules?

Yes. Rules are guidance, not enforcement. They are designed to cut repeat mistakes, but ATC and ABAP Unit stay your gate, and the rules tell the agent to run them via an MCP server when one is available.

Is it safe to use with the ADT MCP server?

The rules tell agents to use MCP read-only (look up objects, run checks) and never use write tools without your explicit consent.

Can I use it in client projects?

Yes, in unlimited own and client projects. You just can't resell or republish the pack itself.

Is this affiliated with SAP?

No. It's an independent product. SAP, ABAP and S/4HANA are trademarks of SAP SE.