Show TOC

Adding ABAP Doc CommentsLocate this document in the navigation structure

A single ABAP Doc comment or a block of several ABAP Doc comments is introduced by the character combination "!.

Positioning ABAP Doc Comments in the Definition

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

So, the ABAP Doc comment has to start before the element, directly in front of a declarative statement (for example, data declaration, method definition, class definition). Otherwise a warning will be displayed. Because, the source code editor verifies the position and the content structure of ABAP Doc comments when you execute the ABAP syntax check. So, if comments are added at the wrong position or contain incorrect syntax, a warning is displayed in the Problems view.

Example

Example for a single ABAP Doc comment:

"! ABAP Doc test
METHODS method_with_variable.

Example for an ABAP Doc of a constant :

"! This is documentation for the following constant
constants co_initial_value type i value 0.
Adding Statements over Multiple Lines

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

Example for a multi line constant definition:

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

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 after the colon.

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