Show TOC

Editing ABAP Doc CommentsLocate this document in the navigation structure

Context

The content of ABAP Doc comments can be imported, added, or entered by a user. You can add ABAP Doc comments within ABAP classes, ABAP interfaces, ABAP programs, and ABAP function groups for elements like classes, methods, locale variables, and so on.

In the editor, the ABAP Doc comments are added one row above the related element in the definition part.

Example of an ABAP Doc comment in the source code:

"! ABAP Doc test
METHODS method_with_variable.

Adding ABAP Doc Comment Blocks

Context

An ABAP Doc comment block is introduced by the character combination "!. It has to be located directly in front of a declarative statement (for example, data declaration, method definition, class definition). Otherwise a warning will be displayed.

The ABAP Doc comment has to start before the element.

Example

"! This is documentation for the following constant
constants co_initial_value type i value 0.

You can use multiple lines to document source code elements. In this case, you have to add the character combination "! in front of each line.

Example

"! This documentation for the following constant is documented
"! in multiple lines.
constants co_initial_value type i value 0.

If you want to document a block of statements using the ABAP colon-comma-semantics, the ABAP Doc comment block must be located in front of the identifier and must be after the colon.

Example for constants

  "! Initial value
  co_initial_value type i value 0,
  "! Invalid value
  co_invalid_value type i value -1.

Formatting ABAP Doc Comments

Context

You can format ABAP Doc comments with XHTML tags.

You can use the following XHTML tags to format text:

Formatting option Tag Alternative Tag
Line break <br/> <br></br>
Paragraph <p>...</p>
Emphasized text <em>...</em>
Strong emphasized text <strong>...</strong>
Unsorted lists <ul><li>...</li></ul>
Sorted lists <ol><li>...</li></ol>
Headers <h1>...</h1> <h2>...</h2> <h3>...</h3>

Example

"Test class" will be formatted as cursive:

"! <em>Test class</em> for demo 
class CL_FOR_TEST_DEMO definition
public
final
create public.