SAP COMMENT
Get Example source ABAP code based on a different SAP table
• * ABAP_COMMENT
• ' ABAP_COMMENT
Comments
A comment is a description inserted in the source code of a program that helps the user better understand the program and that is ignored when the program is generated by the ABAP Compiler. From a technical perspective, a comment can have any content. Two language elements are available for creating comments:
These language elements make it possible to create two types of comments :
ABAP_PGLS
ABAP_PGL_END
Latest notes:
BEGIN_SECTION SAP_INTERNAL_HINT
The characters
END_SECTION SAP_INTERNAL_HINT
NON_V5_HINTS
A special type of line end comments are
ABAP_HINT_END
ABAP_EXAMPLE_VX5
The following example demonstrates the recommended use of comments. Comment lines started by
* 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>
ABAP_EXAMPLE_END