Skip to Content

Create ABAPDoc Comments in Your Class in ABAP Environment

Requires Customer/Partner License
Learn how to maintain ABAPDoc documentation for your class in SAP Business Technology Platform (BTP), ABAP Environment so your comments appear in the Outline view.
You will learn
  • How to maintain ABAPDoc comments
  • How to synchronize comments so they appear in the Outline View
  • How to add an sorted list
  • How to create a link to other development object documentation within ADT
julieplummer20Julie PlummerNovember 8, 2021
Created by
julieplummer20
April 20, 2020
Contributors
julieplummer20

Prerequisites

ABAPDoc comments are used to document your code. This makes it more readable. If other developers use one of your development objects, they can find out more about it by selecting the object name in the code and choosing Element Info ( F2 ).

All ABAPDoc comments begin with "!.

Always replace XXX with your initials or group number.

More Information

  • Step 1

    First, open the ABAP class ZCL_AMDP_DEMO_XXX from the tutorial Create an AMDP and Analyze Its Performance

    Image depicting step-1-open-class
  • Step 2
    1. Immediately before the class definition, add an ABAPDoc comment to the class by entering "! and choosing Auto-complete ( Ctrl+Space ).

    2. From the dropdown list, choose Paragraph, then add the following comment:

      "!<p>Class tests AMDP</p>

      step2a-choose-paragraph

      You must insert the ABAPDoc comment immediately before the declaration; otherwise you will get a warning from ADT.

    3. Add the following to the paragraph ( <p> ) tag: class="shorttext synchronized", so your code looks like this:

      "!<p class="shorttext synchronized">Class tests AMDP: </p>
      
    4. Add the following comments to the table type ty_result_line and to the method GET_FLIGHTS respectively:

      "!<p class="shorttext synchronized">Table type of Flights from HANA DB</p>
      "! <p class="shorttext synchronized"> Method reads flights from HANA DB using AMDP</p>
      
    5. Save and activate your class.

    The comments should now appear in the Outline View:

    step2b-shorttext-synch-class
  • Step 3
    1. Choose Enter. The system automatically inserts the ABAPDoc comments annotation "!" for you.

    2. Again, choose Auto-complete ( Ctrl+Space ). Then choose Sorted list.

      step3a-add-sorted-list
    3. Add the following two statements, so that your code looks like this:

      "! <ol>
      "!    <li>Reads flights from HANA DB</li>
      "!    <li>Converts currency to EUR</li>
      "! </ol>
      
      
  • Step 4
    1. Immediately after the sorted list, choose Enter.

    2. Now enter the following comment:

      "! <p>Implements the interface { @link INTF: if_oo_adt_classrun } </p>

    This creates a link to the Element information for that interface.

  • Step 5
    1. Save and activate your class ( Ctrl+S, Ctrl+F3 ).

    2. Select your class and choose Show code element information (F2).

    3. Your comments should appear look like this:

      step4a-element-info
    4. If you choose the link to the interface, its documentation appears:

      step6b-interface-abapdoc
  • Step 6

    Which of the following object types can you link to, specifically using the syntax { @link kind:name }<br/>Choose all that apply.

Back to top