Few Important points in ABAP Doc with Eclipse:
- ABAP Doc with Eclipse provides developer documentation for ABAP source code development objects (like classes, interfaces, function modules, programs) within the ABAP source code by using ABAP comments
- This enables documentation in HTML format automatically from ABAP source code.
- ABAP Doc is based on special ABAP comments
- A comment for ABAP Doc is introduced with: “!
- An ABAP Doc comment (a line or a block of lines) must be linked to exactly one declaration statement
- ABAP Doc is evaluated in ADT only. If you use ABAP Doc you must be sure that the users of your APIs work in ADT only. In SAP GUI they see the comments but not the formatted documents where they are needed
- ABAP Doc hides existing classical class builder documentation (short and long texts)
- 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.
How to write ABAP Doc:
Example of ABAP Doc:
Consider this Class with Method get_path_new. We write ABAP Doc on top of definition section.
Now Documentation can be access from implementation section as below.
Right Click on Method implementation and go to Source code > Show Method information as shown above.
ABAP Doc Parameters and Exception:
For methods, events, function modules and form routines you can also document the parameters and exceptions. The following syntax is frequent to use to document various sections:
“! This is a Header section example
“! @parameter i_my_param1 | This is first parameter “! @parameter i_my_param2 | This is second parameter “! @parameter o_my_output1 | This is output parameter
“! @raising cx_exception1 | This is first Exception
Note: Ctrl + 1 is quick shortcut which automatically generates template for all parameters and exceptions of the method.
Formatting of ABAP Doc:
Using Ctrl + space or Ctrl + 1 is allowed in allowed comment block. It automatically provides formatting options as below:
Following tags can be used for making ABAP Doc more appealing: