Preface – This post is part of the ABAP Beginner series.
Table of Contents
Mandatory ABAP Syntax for Every Coder
The following ABAP syntax is mandatory for every coder:
- ABAP is not a case sensitive language (It is case sensitive in the case of field name being passed in the function module).
- Every program must start with a keyword.
- Each program must end with a period (.)
- Every chained statement must have a single keyword followed by a colon (:) and the individual statement followed by a comma (,).
Example:
DATA :LV_PLAYER(10) TYPE c,
LV_SCORE (100) TYPE n,
LV_WICKET (10) TYPE n.
- To make the entire line comment use an asterisk (*) mark at the beginning of the statement.
- To make a comment after a statement in the same line, use a double inverted comma (“) before the comment.
- Use PRETTY PRINTER to provide indentation to your codes and make them readable for testers
- Nomenclature: Use the following prefixes before given types of fields
Prefix | Field Name |
LWA | Local Work Area |
GWA/WA | Global Work Area |
LTY | Local Structure |
LT | Local Internal Table |
GT | Global Internal Table |
IT/ITAB | Internal Table |
V | Variable |
C | Contant |
ZRP | Custom Report Program |
ZCL | Custom Class |
LV | Local Variable |
[Note: Use underscores (_) after using prefixes]
- ABAP codes are whitespace sensitive.
Example: a = b+c(d) and a = b + c ( d ) have different meanings. The first one c(d), will give ‘c’ of length ‘d’. The second one will call function ‘c’ with parameter ‘d’. - In the ABAP custom field, i.e. custom reports, custom data element, custom domain always starts with ’Z’. It means everything we are going to create will be custom and not standard (SAP creates standard ones). So, they will start with ‘Z’ or ‘Y’.
Example: ZBarry_Allen might be my report name
- ABAP provides both statements based syntax as well as the expression-based syntax
Example:- ADD Tax to Total.
- Total = Total + Tax.
Both will give the same output.
0 Comments