How To Fix SABAP_DOC106 - ABAP Doc comments behind statements are not allowed


SAP Error Message - Details

  • Message type: E = Error

  • Message class: SABAP_DOC - ABAP Doc messages

  • Message number: 106

  • Message text: ABAP Doc comments behind statements are not allowed

  • Show details Hide details
  • What causes this issue?

    The ABAP-Doc-comment is located at the wrong position in the source
    code.
    An ABAP-Doc-comment-block is introduced by the character combination "!.
    It has to be located directly in front of a declarative statement (e.g.,
    data declaration, method definition, class definition).

    The system issues an error message and will not allow you to continue with this transaction until the error is resolved.

    Example
    <EX>"! This is a documentation for the following constant</>
    <EX>constants co_initial_value type i value 0.</>
    You can use multiple lines for your documentation to document your
    source code elements. In this case you have to add the character
    combination "! in front of each line.
    Example
    <EX>"! This documentation for the following constant is documented</>
    <EX>"! in multiple lines.</>
    <EX>constants co_initial_value type i value 0.</>

    System Response

    Syntax check returns a warning.

    How to fix this error?

    Put the ABAP-Doc comment at the right position in the source code.
    If the comment is not an ABAP-Doc-comment, but a standard comment and
    starts with the character combination "!, you can add a space between
    the characters " and ! to declare this comment as standard comment.

    Procedure for System Administrators


    Error message extract from SAP system. Copyright SAP SE.


Smart SAP Assistant

  • What is the cause and solution for SAP error message SABAP_DOC106 - ABAP Doc comments behind statements are not allowed ?

    The SAP error message SABAP_DOC106 indicates that there are ABAP documentation comments (using the * syntax) placed directly behind ABAP statements, which is not allowed in the ABAP programming language. This error typically occurs when you try to document your code in a way that is not compliant with the ABAP syntax rules.

    Cause:

    In ABAP, documentation comments must be placed on their own line or must be formatted correctly. The error occurs when you attempt to place a comment directly after a statement on the same line, which is not permitted for documentation comments.

    Example of the Error:

    DATA: lv_value TYPE i. " This is a regular comment
    lv_value = 10. " This is a documentation comment and will cause SABAP_DOC106

    Solution:

    To resolve this error, you need to ensure that your documentation comments are placed correctly. Here are the steps to fix it:

    1. Move the Documentation Comment: Place the documentation comment on a separate line before the statement or use the correct syntax for inline comments.

      Correct Example:

      " This is a documentation comment
      DATA: lv_value TYPE i.
      lv_value = 10. " This is a regular comment
    2. Use Inline Comments Appropriately: If you want to use inline comments, ensure they are not ABAP documentation comments. Use the regular comment syntax (") for inline comments.

    Related Information:

    • ABAP Documentation Comments: In ABAP, documentation comments are typically used to provide detailed descriptions of classes, methods, and other program elements. They are usually formatted using the * syntax and should be placed above the code they describe.

    • ABAP Syntax Rules: Familiarize yourself with the ABAP syntax rules to avoid similar errors. The SAP Help Portal and ABAP documentation provide comprehensive guidelines on how to write comments and documentation in ABAP.

    • ABAP Development Tools: If you are using tools like ABAP Development Tools (ADT) in Eclipse, they often provide real-time syntax checking and can help you identify such issues before you attempt to activate or run your code.

    By following these guidelines, you should be able to resolve the SABAP_DOC106 error and write compliant ABAP code.

    • Do you have any question about this error?


      Upgrade now to chat with this error.


Instant HelpGet instant SAP help. Start your 7-day free trial now.


Related SAP Error Messages

Click the links below to see the following related messages:

Click on this link to search all SAP messages.


Rating
ERPlingo's SAP support assistant is amazing. Saves me countless hours trying to solve complex SAP issues myself. It's a real game changer!
Rate 1
Thomas Michael
SAP Consultant, Author & Speaker