SAP ABAP Syntax

Learn how to write ABAP program using below ABAP syntax in SAP system.

Statement

SAP ABAP program is a collection of statements, each statement begins with a keyword and ends with a period.The first line of statement start with a word PROGRAM or REPORT and followed by the name.

The syntax is

Statement is a combination of keywords, operators, data types, constants, etc. Below an example of ABAP syntax of report statement type.

Keywords

The ABAP statement starts with a keyword and that determines the meaning of ABAP statement. The different types of keywords are

  • Declarative keywords :  -These keywords are used to create variable constants and data types. for e.g. Constants, data, types, etc.
  • Control keywords : – These keywords are used to control flow of ABAP program. For e.g. If, Case, Do, While, etc
  • Event keywords : – These keywords are used to define blocks (set of statements) externally. For e.g. Top – of – page, End – of – page.
  • Operational keywords – These keywords are used to process the data in an ABAP program. For e.g. Add, Subtract, divide, multiply, etc.

Comments

Comments are descriptive text between the lines of ABAP program. Comments are not executed during run time or execution. Symbol * is used in first column of sentence. The different types of comments that are used in ABAP programming are

  • Line commenting
  • Block commenting
  • Partial commenting

Messages

Message class are user defined messages, so we can create our own messages to display on the screen. We can create up to 1000 messages in a single message class and message ID numbers are ranges from 0 to 999. The created messages can be called from program using statement “MESSAGE”.

ABAP Syntax is