ABAP Doc @Eclipse

Index

Few Important points:

  • ABAP Doc can be used to provide developer documentation for ABAP source code development objects (like classes, interfaces, function modules, programs) within the ABAP source code by using ABAP comments
  • ABAP Doc enables documentation in HTML format to be created 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:

Multiline:

Single line:

Example of ABAP Doc:

Consider this Class with Method get_path_new. ABAP Doc is written 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 used to document various sections:

Header:

“! This is a Header section example

Parameter:

“! @parameter i_my_param1 | This is first parameter

“! @parameter i_my_param2 | This is second parameter

“! @parameter o_my_output1 | This is output parameter

Exception:

“! @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:

Formatting Tags in ABAP Doc appear on pressing Ctrl + Space or Ctrl + 1

Following tags can be used for making ABAP Doc more appealing:

ABAP Doc Formatting tags

Example:

Formatting example using ABAP Doc

Index

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s