SAP COMMENT
Get Example source ABAP code based on a different SAP table
ARTICLE
Comments
• * ABAP_COMMENT
• ' ABAP_COMMENT
A comment is an explanation that is added to the source text of a program to help the person reading the program to understand it. C omments are ignored when the program is generated by the ABAP Compiler. From a technical perspective, a comment can have any type of content. Two language elements are available for creating comments:
These language elements enable create two categories of comment to be created:
Note
A special category of line end comments are
Example
The following example demonstrates how to use comments. Comment lines added with
* Class implementations *
*----------------------------------------------------------*
CLASS application IMPLEMENTATION.
METHOD main.
DATA: items TYPE STANDARD TABLE
OF REF TO item, 'Item table
item_ref LIKE LINE OF items. 'Item reference
DATA: amount TYPE i, 'Amount per item
total_amount TYPE i. 'Total amount of items
...
'Loop over all items to compute total amount
LOOP AT items INTO item_ref.
IF item_ref IS BOUND AND
item_ref->is_valid( ) = abap_true.
'Compute total amount for valid items
amount = item_ref->get_amount( ).
ADD amount TO total_amount.
...
ELSE.
...
ENDIF. 'item_ref IS BOUND AND...
ENDLOOP.
...
ENDMETHOD. 'main
ENDCLASS. 'application