Summary -

Comments or Non-executable statements definition are self-explanatory. Comments generally used to understand the code easily for the programmers. Comments are do nothing statements and are ignored by the computer.

There are two types of comments that are supported in ABAP editor and those are -

  • Full line comments or Comment Lines
  • Partial comments or End of line comments

Full line comments or Comment Lines -

Full line comment contains only a comment for the full line and nothing else.

Full line comments can be made by using asterisk (*) or quote(") as a first character of the entire line. If the line starts with * or ", then those lines are considered as comments and ignored by the compiler while generating program.

For example, let us write a full line comment below –

* Full line comment in SAP.

Partial comments or End of line comments –

If user creates a comment at the end of the executable statement (after a period), those called as a partial comment. Partial comment should get started with double quote (“). If any information starts with “, then those are ignored by the compiler while generating program. Otherwise, compilation errors occurred.

For example, let us write a partial comment below –

Write 'Hello World..!'.  "Starting of a Partial comment

Note! ABAP Editor not capitalize the comment either it may be a full or partial comment code.

Example -

Write a program to show case full and partial comments.


Code -

*&---------------------------------------------------------------------*
*& Report  Z_COMMENTS
*&---------------------------------------------------------------------*
*& Written by TutorialsCampus
*&---------------------------------------------------------------------*

REPORT  Z_COMMENTS.

* Full line comment
WRITE 'Hello World..!'. "partial comment

Output -

Comment Example Output

Explaining Example -

In the above example, each and every statement is preceeded with a comment to explain about the statement. Go through them to get clear understanding of example code.

* Full line comment - Full line comment in the program. " partial comment - Partial line comment in the program.