Skip to content
serhatmercanPublic

About

Practical SAP ABAP engineering reference covering classic, object-oriented and modern ABAP, with explicit lifecycle guidance for enterprise landscapes.

Topics

Resources

Stars

8 stars

Watchers

2 watching

Forks

Latest commit

 

History

270 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ABAPGuide — A Practical SAP ABAP Engineering Reference

A working reference for SAP ABAP as it is actually written in productive landscapes — from classic procedural and dynpro code through ABAP Objects to modern expression syntax and ABAP SQL. Built from accumulated real SAP project notes, patterns and examples, and organised so that each technology carries an explicit lifecycle status: what is current, what is classic but still live, and what is there for historical reference.

That last part is the point. Real SAP systems run several generations of ABAP at once. A reference that shows only the newest syntax is no help when you open a twelve-year-old pricing routine; one that shows everything without saying which is which is no help either.

Scope

  • Covers: ABAP language fundamentals, internal tables, ABAP SQL, modularization, ABAP Objects, classical reports, selection screens and dynpro, three generations of ALV, batch input, BAPIs, BAdIs and the enhancement framework, messages and exceptions, performance, ABAP Unit, debugging and troubleshooting, mail, HTTP, table maintenance, lock objects, Adobe forms, transport and quality gates, development tools and AI assistance, business workflow, and IDoc and ALE — including the modern (7.40-generation) expression syntax throughout.
  • Does not cover: RAP, CDS, AMDP, or ABAP Cloud beyond the boundary explained in Chapter 21. That is a deliberate boundary, not an oversight.
  • Coding rules: new and changed examples follow docs/ABAP-Development-Rules.md.
  • Examples are illustrative. They are written to teach a pattern, not to be dropped into production unchanged. See How to Use.
  • Not official SAP documentation. For anything version-sensitive, the ABAP Keyword Documentation is the authority.

🤖 Use It with Your AI Assistant

  1. Copy the rules into your project. Put ai/AGENTS.md, one line per rule, at the root of your ABAP project. Claude Code, GitHub Copilot and Cursor can read a file of that name.
  2. Use the guide as a reference. Clone this repository next to your project, point your instruction file to it, and name chapters and rules in your prompts ("follow Chapter 24 and Rules 8.5 and 8.11").
  3. Give it the full rule set when cost matters less than detail: docs/ABAP-Development-Rules.md. In a small experiment it cost about 2.5 times as much as no rule file, the compact file about 1.5 times.

ai/README.md covers how each assistant reads these files, with an instruction snippet to paste, example prompts and how to keep your copy up to date.

✨ Highlights

  • 35 structured chapters plus a quick-reference Examples section
  • 200+ annotated ABAP code snippets written for this guide
  • Explicit classic-to-modern lifecycle guidance on every major technology
  • Internal tables and modern expressions — VALUE, FOR, REDUCE, FILTER, COND, table expressions, secondary keys
  • ABAP SQL in depth — joins, subqueries, aggregation, FOR ALL ENTRIES and its pitfalls, dynamic SQL
  • Three ALV generations side by side — CL_SALV_TABLE, REUSE_ALV_*, CL_GUI_ALV_GRID
  • Integration and extensibility — BAPIs, BAdIs, enhancements, BDC, RFC, with the transaction and authorization implications spelled out
  • Testing and troubleshooting — ABAP Unit with test doubles, debugging and short dumps, transport and quality gates
  • Integration components — mail, HTTP and REST, Adobe forms, business workflow, IDoc and ALE, each behind an interface and tested without side effects

🧭 Classic vs Modern ABAP

→ Chapter 21 — Classic vs Modern ABAP

The chapter that ties the rest together: why productive landscapes contain several ABAP generations, what to use for new on-premise development, what remains classic but relevant, what is historical reference, and what changes under ABAP Cloud. Includes a decision table for the common maintenance and greenfield scenarios.

🔍 Find It Fast

I need to… Chapters
Get the language fundamentals right 01 · 02 · 03 · 04 · 05
Work with internal tables and modern expressions 06 · 07
Read or write database data safely 08 · 15
Structure and reuse code 09 · 10
Build a report or a screen 11 · 12 · 13
Run a report in the background or exchange files 11
Load data into a transaction that has no API 14 · 15
Integrate or extend standard SAP 14 · 15 · 16 · 17
Report messages, raise exceptions and keep logs 18 · 15
Tune runtime and memory 19
Review code against a checklist 20
Write unit tests and test doubles 22
Debug a problem or read a short dump 23 · 18
Send a mail with attachments 24 · 11
Call or provide an HTTP/REST service 25 · 09
Let users maintain settings and Customizing 26 · 08
Protect data from concurrent changes 27 · 08
Print a form or get a PDF 28 · 24
Transport a change and pass the quality gates 29 · 22
Set up the tools or an AI assistant 30 · 20
Give an AI assistant the rules, and see what they changed ai/README.md · experiment/README.md
Start an approval process or react to a business event 31 · 10
Exchange documents with other systems (IDoc, ALE) 32 · 15
Define tables, data elements and domains (ABAP Dictionary) 33 · 26 · 02
Check authorizations and find out why a check failed 34 · 26 · 22
Assign document numbers and log changes 35 · 08 · 27
Decide between classic and modern 21

🏷️ Lifecycle Legend

Chapters and examples are labelled with one of these. Full definitions in Chapter 21.

Label Meaning
CURRENT / RECOMMENDED Reach for this in new on-premise development
CLASSIC BUT STILL RELEVANT Widespread and supported; you must be able to maintain it
LEGACY / HISTORICAL REFERENCE Superseded — read it, don't write it
ABAP CLOUD / MODERN CONTEXT Belongs to, or explains, the ABAP Cloud development model
VERSION-DEPENDENT Availability depends on your release — verify before relying on it

📂 Chapter Reference

The Context column lists every lifecycle label a chapter uses, in the short form of the Lifecycle Legend.

Folder Topic Description Context
01-ABAP-Basics ABAP Basics Program structure, report events, console class in ADT, syntax fundamentals Current + Classic + Legacy
02-Data-Types Data Types Elementary types, structures, type conversions Current + Legacy
03-Variables Variables DATA, CONSTANTS, inline declarations, FORM/PERFORM Current + Classic + Legacy + Version-dependent
04-Operators Operators Arithmetic, comparison, built-in math functions Current
05-Control-Statements Control Statements IF, CASE, CHECK, COND, SWITCH Current + Classic
06-Loops Loops LOOP, DO, WHILE, control breaks, GROUP BY, COLLECT, ranges Current + Classic + Version-dependent
07-Internal-Tables Internal Tables Table types, keys, VALUE/FOR/REDUCE/FILTER, field symbols Current + Legacy
08-Open-SQL ABAP SQL SELECT, joins, SQL functions (CAST, COALESCE, string and date functions), aggregation, CRUD, SAP LUW & transaction ownership Current + Version-dependent
09-Modularization Modularization Function modules, conversion exits, RFC, macros, SUBMIT Current + Classic + Legacy
10-Objects Objects / OOP Classes, visibility, inheritance, static vs. instance, interfaces, constructors, events Current + Legacy
11-Classical-Reports Classical Reports List events, WRITE, dynamic tables + authorization, background jobs and application jobs, files Classic + Legacy + Cloud + Version-dependent
12-Selection-Screens Selection Screens & Dynpro Selection screens, PBO/PAI, screen modification, value help, table controls, popups Classic
13-ALV ALV CL_SALV_TABLE, REUSE_ALV_*, CL_GUI_ALV_GRID, field catalogs, events Current + Classic + Legacy
14-Function-Modules Batch Input (BDC) & Calling Transactions CALL TRANSACTION … USING, BDC tables, modes, sessions, messages, SAP LUW, authorization Classic
15-BAPIs BAPIs BAPIRET2, transaction control, standard call pattern Classic
16-BADIs BAdIs Classic vs. new BAdIs, filters, implementation pattern Current + Classic
17-Enhancements Enhancements User exits vs. customer exits, enhancement points, modifications Current + Classic + Legacy + Version-dependent
18-Debugging Messages, Exceptions & Logging MESSAGE and message types, translatable texts, return tables, class-based and classic exceptions, application log Current + Classic + Version-dependent
19-Performance Performance & Memory Measuring with SAT, ST05 and ADT profiling, internal table tuning, ABAP Memory, database access Current + Classic + Version-dependent
20-Best-Practices Best Practices & Clean ABAP Clean ABAP naming, classic prefixes as a reading aid, rule summaries, refactoring example, review checklist Current + Classic + Legacy + Version-dependent
21-Classic-vs-Modern-ABAP Classic vs Modern Lifecycle map, ABAP Cloud boundary, clean core and extensibility options, decision table Current + Classic + Legacy + Cloud + Version-dependent — start here for context
22-ABAP-Unit ABAP Unit Test classes, fixtures, assertions, test doubles, ABAP SQL test environment, test seams, running tests Current + Classic + Legacy + Version-dependent
23-Debugging-Troubleshooting Debugging & Troubleshooting ABAP Debugger, breakpoints and watchpoints, BREAK-POINT/ASSERT/LOG-POINT and checkpoint groups, short dumps, troubleshooting method, common runtime errors Current + Version-dependent
24-Mail Mail (BCS) Sending mail through an interface, BCS and the released mail API, HTML bodies, attachments, commit and monitoring, addresses from configuration, testing without sending Current + Classic + Legacy + Cloud + Version-dependent
25-HTTP-REST HTTP and REST Calling and providing HTTP services through an interface, classic and released client and handler APIs, destinations instead of URLs, CSRF tokens, JSON, security in handlers, testing without network calls Current + Classic + Cloud + Version-dependent
26-Maintenance-Views Table Maintenance and Maintenance Views Customizing tables, delivery class and client, SE54 and SM30, maintenance views and view clusters, authorization groups, maintenance dialog events, regeneration, Customizing transport, change logging, business configuration maintenance in ABAP Cloud Classic + Cloud + Version-dependent
27-Lock-Objects Lock Objects and the SAP Lock Concept Lock objects, generated ENQUEUE_/DEQUEUE_ modules, lock modes, _scope and the SAP LUW, the released lock API, a lock behind an interface, pessimistic and optimistic locking, SM12, locks in maintenance dialogs, testing with a lock double Current + Classic + Cloud + Version-dependent
28-Adobe-Forms Adobe Forms and PDF Output Form interface, form and context in SFP, the layout described, Adobe Document Services, FP_JOB_OPEN and the generated function module, the PDF as xstring for mail or file, the released forms API, output behind an interface, Smart Forms and SAPscript as lifecycle reference Classic + Cloud + Version-dependent
29-Transport-Quality-Gates Transport and Quality Gates Packages and $TMP, clean-core development in Standard ABAP, the Change and Transport System, object locks in requests, request hygiene and a tested release rule, transport in the SAP BTP ABAP environment, ATC check variants and exemptions, adapting custom code with usage data and readiness checks, abaplint and CI Current + Cloud
30-Tools-AI-Assistance Development Tools and AI Assistance ADT for Eclipse and VS Code, SAP GUI tools, source search, ABAP Cleaner, abapGit, what an AI assistant needs, SAP's Joule for developers, MCP servers for ADT, the safety model and observed tool limits Current + Version-dependent
31-Business-Workflow Business Workflow and My Inbox Workflow building blocks, BOR and IF_WORKFLOW classes, events and type linkages, agent rules, work items in the Business Workplace and My Inbox, administration, flexible workflow, the cloud hand-over, testing without starting a workflow Classic + Cloud
32-IDoc-ALE IDoc and ALE IDoc structure, message types, ports, partner profiles and the distribution model, outbound processing and change pointers, inbound function modules and status handling, posting through BAPIs, monitoring and reprocessing, the cloud hand-over, testing without an IDoc Classic + Cloud
33-ABAP-Dictionary ABAP Dictionary Domains, data elements, structures and includes, table types, database tables in ADT with technical settings and indexes, foreign keys, check and text tables, search helps, reading a table definition, changing an active table, enhancement categories and appends, classic Dictionary views, the Dictionary in ABAP for Cloud Development Current + Classic + Legacy + Cloud + Version-dependent
34-Authorization-Checks Authorization Checks The authorization concept, AUTHORITY-CHECK and its return codes, DUMMY and FOR USER, where the check belongs, the check behind an interface, testing with the ABAP Unit authorization test environment, tracing a failed check, SU24 as context, authorization in ABAP for Cloud Development Current + Cloud + Version-dependent
35-Number-Ranges-Change-Documents Number Ranges and Change Documents Number range objects, intervals and buffering, drawing a number with CL_NUMBERRANGE_RUNTIME and the SAP LUW, change document objects and the generated write class, reading change documents with CL_CHDO_READ_TOOLS, ABAP for Cloud Development and the RAP hand-over, testing with doubles Current + Classic + Cloud + Version-dependent
Examples Examples Strings and regular expressions, dates/times and utclong, conversions Current + Legacy + Version-dependent

🚀 How to Use

  1. Jump to the chapter matching your need via Find It Fast, or read Chapter 21 first for the lifecycle map.
  2. Each chapter follows the same shape: introduction → examples → best practices → common mistakes → interview & review checkpoints → related transaction codes (where relevant) → related chapters.
  3. Understand what kind of snippet you are reading:
    • Complete examples — self-contained programs or classes (for instance the ALV reports in Chapter 13). These show a full working structure.
    • Contextual snippets — the majority. They demonstrate one statement or pattern and assume surrounding declarations. Adapt the names and types to your own program.
  4. Examples are illustrative, not production-ready as-is. They are simplified to make the pattern visible: error handling, authorization checks and locking are shown where they are the point being made, and abbreviated where they are not. Review any snippet against your own standards before using it, and syntax-check it in your target system.
  5. Working with an AI assistant? See Use It with Your AI Assistant.

⚙️ Compatibility & Version Notes

  • This guide uses the modern expression syntax introduced across the ABAP 7.40 generation — inline declarations, VALUE, NEW, CONV, CORRESPONDING, COND, SWITCH, REDUCE, FILTER, FOR, table expressions and string templates.
  • Individual ABAP SQL features require later releases. SQL expressions in the field list, host expressions, and internal tables as data sources all arrived progressively across the 7.4x/7.5x releases, not all at once. These are flagged VERSION-DEPENDENT where they appear.
  • This guide deliberately states no exact minimum release or support-package numbers. Verify each feature against the ABAP Keyword Documentation for your target system before relying on it.
  • Terminology: SAP's current umbrella term for the SQL statements is ABAP SQL; "Open SQL" is the historical name and is still in wide use. Both appear here. The chapter folder keeps its 08-Open-SQL name so existing links continue to work.
  • Tooling: ABAP Development Tools (ADT) are assumed; Chapter 30 covers ADT for Eclipse and ADT for VS Code. The classic workbench (SE38/SE80/SE24/SE37) is assumed knowledge where transaction codes are referenced.

👥 Who This Is For

  • SAP developers maintaining productive ABAP who need a working example fast, with the context to know whether the pattern is still the right one.
  • Engineers modernizing classic ABAP who need to tell deliberate legacy from accidental legacy before they change anything.
  • Developers working across SAP GUI and modern ABAP syntax, where both generations sit in the same program.
  • Technical leads reviewing implementation patterns — the per-chapter review checkpoints and the Chapter 20 checklist are written for that use.

Newcomers to ABAP will find the chapters readable in order, but the reference is written for people who already program.

🤝 Contributing

Corrections and additions are welcome — particularly anything that fixes a technical inaccuracy or clarifies a lifecycle classification.

  1. Fork the repository and create a branch (git checkout -b improvement/topic-name).
  2. Keep the existing chapter structure and lifecycle labelling.
  3. For anything version-sensitive, cite the ABAP Keyword Documentation rather than asserting a release number.
  4. Open a pull request describing the change.

💬 Feedback

Open an issue with one of the templates:

  • Content error — a statement, code example or link that is wrong or out of date.
  • Missing topic — something within the scope above that the guide does not cover.
  • Rule discussion — a question about, or a proposed change to, a rule in docs/ABAP-Development-Rules.md.
  • Experiment result — a run of the experiment on your own sandbox.

Never post system IDs, client numbers, user names, host names, customer data or screenshots that show any of them.

🛠️ Maintenance

  • docs/ABAP-Development-Rules.md is the binding rule set; Chapter 20 gives one line per rule and links to it.
  • ai/AGENTS.md is generated from Chapter 20 and the rules by tools/build_compact_rules.py. After a change to either, it is regenerated, and python tools/build_compact_rules.py --check must pass.
  • Experiment results are dated and frozen. A new run goes into a new experiment/results/<YYYY-MM>/ folder; corrections to published material go into the errata list of experiment/README.md.
  • Statements that depend on a release or a tool version are labelled VERSION-DEPENDENT and point to the official documentation; a check is claimed only after it ran (Rule 13.5).

🔗 Related Guides

Guide Focus
ABAPGuide (this repository) ABAP language and techniques, classic to modern
CDSGuide ABAP CDS, structured route through both generations
CDS-Cookbook CDS and AMDP pattern library
GWGuide SAP Gateway: SEGW and OData V2
UIGuide SAPUI5 and Fiori control and pattern reference
JSGuide Plain JavaScript and browser APIs
PYGuide Python reference with verified outputs

👤 Author

Serhat Mercan — SAP BTP & AI Technical Lead | Generative AI for SAP | ABAP & SAP Fiori/UI5

📄 License

Licensed under the MIT License — free to use for learning, teaching and reference.

About

Practical SAP ABAP engineering reference covering classic, object-oriented and modern ABAP, with explicit lifecycle guidance for enterprise landscapes.

Topics

Resources

Stars

8 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages