ABAP Syntax

What is the Mandatory ABAP Syntax that must be followed by every coder?

  1. ABAP is not a case sensitive language (It is case sensitive in the case of field name being passed in Function Module)
  2. Every Program must start with a Keyword
  3. Every Program must end with a Period (.)
  4. 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.

  1. To make entire line comment use asterisk (*) mark at the beginning of statement
  2. To make a comment after a statement in same line use double inverted comma (“) before the comment
  3. Use PRETTY PRINTER to provide indentation to your codes and make them readable for testers
  4. Nomenclature: Use 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]
  1. ABAP codes are whitespace sensitive.
    Example: a = b+c(d) and a = b + c ( d ) have different meaning, the first one c(d) will give ‘c’ of length ‘d’ while second one will call function ‘c’ with parameter ‘d’.
  2. In 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 (Standard ones are created by SAP). So, they will start with ‘Z’ or ‘Y’.

Example: ZBarry_Allen might be my report name

 

  1. ABAP provides both Statements based syntax as well as Expression based syntax
    Example:

    1. ADD Tax to Total.
    2. Total = Total + Tax.

Both will give same output.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Translate »