ABAP Doc enables the documentation of ABAP objects on the basis of specific comments.
It can be used to document global objects such as classes and interfaces as well as their methods and attributes. ABAP Doc documentation can also exist for local objects such as local variables. In a development environment such as the ABAP development tools for Eclipse, the content of ABAP Doc comments is evaluated, converted to HTML, and then displayed in a suitable manner.
An ABAP Doc comment is introduced by the "! string:
"! Describing the ingredients
The documentation created can be displayed in the ABAP development tools in the ABAP Element Info view. You can call this view by clicking on an object documented with ABAP Doc and pressing the (F2) key. A popup window appears in which all the information that has been documented gets displayed.
To use multiple lines for the documentation of source code, each line must start with "!:
"! Load the recipe information using
"! the recipe ID in table ZACB_RECIPE
This table lists the various tags that can be used to format the output of ABAP Doc comments.
| Formatting option | Tag |
| Line break | <br/> or <br></br> |
| Paragraphc | <p>...</p> |
| Highlighted text | <em>...</em> |
| Strongly highlighted text | <strong>...</strong> |
| Unsorted lists | <ul><li>...</li></ul> |
| Sorted lists | <ol><li>...</li></ol> |
| Headings |
<h1>...</h1> <h2>...</h2> <h3>...</h3> |
The use of these formatting options is shown as an example here:
"! All ingredients for the sample recipe
"! <ul><li>Quantity: 100</li>
"! <li>Unit: g</li>
"! <li>Name: Flour</li></ul>
ingredients TYPE TABLE OF zacb_ingredient.
"! Load the <em>recipe information</em> using the
"! recipe ID in table <strong>ZACB_RECIPE</strong>
METHODS load_recipe RAISING zcx_acb_recipe_not_found.
These formatting options are implemented visually in the ABAP Element Info view.
The parameters and exceptions can be documented for methods, events, function modules, and subroutines. The table below shows the syntax used for parameters and exceptions.
| Documentation For | Syntax |
| Parameter | @parameter <parameter name> | <parameter documentation> |
| Class-based exceptions | @raising <exception name> | <exception documentation> |
| Classic exceptions | @exception <exception name> | <exception documentation> |
This listing shows an example of the documentation of parameters and exceptions.
"! @parameter recipe_id | Transfer of a recipe ID
"! @raising zcx_acb_recipe_not_found | error, if no
"! entry for the recipe ID can be found.
METHODS constructor IMPORTING recipe_id
TYPE zacb_recipe_id RAISING zcx_acb_recipe_not_found.
This ABAP Doc comment results in the display in the ABAP Element Info view shown in the figure below.
ABAP Doc and the classic short text description can also be combined. This is made possible by the "shorttext" attribute. A short text description looks as follows in ABAP Doc:
"! <p class="shorttext">Class for recipes</p>
If the "synchronized" attribute is now also added, short text descriptions and ABAP Doc comments can be synchronized:
"! <p class="shorttext synchronized">Class for recipes</p>
The following figure shows the connection between the ABAP Doc comment and the description for the ZCL_ACB_RECIPE class in the editor and in the project structure.
The length of the description is limited to the length for short text descriptions of the respective repository object.
You can generate ABAP Doc from existing descriptions of global classes and interfaces. To import descriptions into classes or interfaces, simply open the development object, and select the Source Code > Import ABAP Doc from Descriptions item in the menu bar (see figure below). The imported texts are automatically synchronized.
The imported texts also have the lang attribute, shows the main language of the development object:
"! <p class="shorttext synchronized lang="en">Class for recipes</p>
Note that you can’t add other languages. The editor would display a warning in this case.
The synchronized attribute should be used if not only the ABAP development tools but also the ABAP Workbench is used in the company.
An ABAP Doc comment can also contain a reference to other repository objects:
... {@link [[[kind:]name.]...][kind:]name} ...
A path to a repository object can be specified in curly brackets after @link to reference its documentation. This is followed by the following attributes:
The following is an example of a reference to the documentation of the ZCX_ACB_RECIPE_NOT_FOUND exception class:
"! Error if no entry can be found for recipe ID
"! {@link ZCX_ACB_RECIPE_NOT_FOUND}
If you now call the ABAP Element Info view via the (F2) function key, this link is displayed.
In the ABAP development tools, you can export ABAP Doc documentation for classes and interfaces in HTML files. To do this, follow these steps:
1. In the project explorer, select a package, class, or interface. Select the Export item from the context menu. Alternatively, you can also select File > Export in the menu bar.
2. In the wizard that opens, select the ABAP Doc item under ABAP.
3. Confirm your selection by clicking the Next button.
4. In the next step, select classes, interfaces, and entire packages (see figure below). In addition, choose the visibility (Public, Public and protected, or Public, protected and private) to define which type of methods should be documented. For example, only public methods should be exported.
5. Specify the storage location in the Directory field.
6. Once you’ve entered all the details, start the export by clicking the Finish button.
You’ll be notified of the successful export (see next figure) and can go directly to the corresponding folder from there.
For each documented class, an HTML page containing the ABAP Doc documentation was generated. In the figure below, you can see this page for our ZCL_ACB_RECIPE class.
ABAP Doc provides a straightforward way to create inline documentation that integrates directly with your development workflow. By using simple comment syntax and formatting tags, you can document classes, methods, and parameters without leaving your code editor, and the export functionality lets you generate standalone HTML documentation when needed.
Ready to level up your ABAP skills? Explore the full range of our ABAP-focused online courses, from foundational programming to advanced RAP, CDS, AMDP, unit testing, and more. Each one is instructor-led (live and on-demand), includes recordings and slide decks, and is designed to give you practical take-away skills you can apply right away in your SAP landscape. Click on the banner below to get started!
Editor’s note: This post has been adapted from a section of the book ABAP Cookbook: Practical Recipes for Modern Programming by Fabian Lupa and Sven Treutler. Fabian is a senior software engineer and trainer at Adesso, where he has worked since 2022. His primary responsibility is employee training and development in the context of ABAP programming, as well as developer enablement in customer projects. Sven is a passionate ABAP developer. He has worked on ABAP development at rku.it GmbH in Herne since 2010. There, he focuses on new technologies and quality assurance in the ABAP environment.
This post was originally published 5/2026.