How To Fix SABAP_DOC105 - Wrong position for ABAP Doc comment in a chained statement


SAP Error Message - Details

  • Message type: E = Error

  • Message class: SABAP_DOC - ABAP Doc messages

  • Message number: 105

  • Message text: Wrong position for ABAP Doc comment in a chained statement

  • 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).
    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.</>
    If you want to document a block of statements by using the ABAP
    colon-comma-semantic the ABAP Doc comment block must be located in front
    of the identifier and must be after the colon.
    Example
    <EX>constants:</>
    <EX> "! Initial value</>
    <EX> co_initial_value type i value 0<(>,<)></>
    <EX> "! Invalid value</>
    <EX> co_invalid_value type i value -1.</>

    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

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


    Error message extract from SAP system. Copyright SAP SE.


Smart SAP Assistant

  • What is the cause and solution for SAP error message SABAP_DOC105 - Wrong position for ABAP Doc comment in a chained statement ?

    The SAP error message SABAP_DOC105 indicates that there is an issue with the placement of an ABAP documentation comment in a chained statement. This error typically arises when the documentation comment (which starts with * or " for single-line comments) is not positioned correctly in relation to the code it is meant to document.

    Cause:

    The error occurs when:

    • The documentation comment is placed in a way that disrupts the flow of the chained statement.
    • The comment is not aligned with the syntax rules of ABAP, particularly in the context of chained statements (e.g., when using IF, CASE, or method calls).

    Solution:

    To resolve the SABAP_DOC105 error, you should:

    1. Check the Position of the Comment: Ensure that the comment is placed on a separate line before the statement it is documenting or at the end of the line, but not in the middle of a chained statement.

      For example, instead of:

      IF condition. " This is a comment
          " Do something
      ENDIF.

      You should write:

      " This is a comment
      IF condition.
          " Do something
      ENDIF.
    2. Avoid Inline Comments in Chained Statements: If you are using chained statements, avoid placing comments inline. Instead, place comments on separate lines.

    3. Review the Code Structure: Ensure that your code structure adheres to ABAP syntax rules. If you are using multiple statements in a single line, consider breaking them into separate lines.

    Related Information:

    • ABAP Documentation: Familiarize yourself with the ABAP documentation standards and best practices for writing comments. Proper documentation helps maintain code readability and clarity.
    • Chained Statements: Understand how chained statements work in ABAP. This includes knowing how to properly format IF, CASE, and other control structures.
    • SAP Notes and Community: If you continue to face issues, consider checking SAP Notes or the SAP Community for similar issues and solutions shared by other developers.

    By following these guidelines, you should be able to resolve the SABAP_DOC105 error and improve the quality of your ABAP code documentation.

    • 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 simplifies finding the accurate answers to SAP message errors. I now use every week. A must have tool for anyone working with SAP! Highly recommended!
Rate 1
Kent Bettisworth
Executive SAP Consultant