A single ABAP Doc comment or a block of several ABAP Doc comments is introduced by the character combination "!.
In the editor, 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 of a single ABAP Doc comment:
"! ABAP Doc test METHODS method_with_variable.
Example of an ABAP Doc of a constant:
"! This is documentation for the following constant CONSTANTS co_initial_value TYPE i VALUE 0.
In the implementation of a global class, you can document a method. You can use the Add ABAP Doc quick assist to add the <p class="shorttext synchronized"> tag. Then an ABAP Doc comment block containing the relevant tag is added. If a description already exists for this method in the back end, its short text, parameters, and exceptions will be synchronized and updated in the source code.
To do this, proceed as follows:
The Quick Fix dialog box is opened.
An ABAP Doc comment block is added to your source code, which contains the relevant tag:
"! <p class="shorttext synchronized" lang="en"></p> "!
Enter the relevant short text before the closing </p> tag.
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 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.
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.
CONSTANTS: "! Initial value co_initial_value TYPE i VALUE 0, "! Invalid value co_invalid_value TYPE i VALUE -1.