What is a keyword?

The first element of the ABAP statement is called as ABAP keyword. A keyword determines the ABAP statement category.

ABAP keywords are the vocabulary of the ABAP language. ABAP keywords are the elements of an ABAP statement. ABAP statements are composed of keywords, operands, and operators according to the predefined syntax rules.

ABAP keywords can also contain hyphens (-) to form multi-word expressions. For example, ADD-CORRESPONDING, END-OF-FILE, END-OF-PAGE etc,.

ABAP keywords are not reserved names. Although the use of an ABAP word for naming conventions is not restricted, however it should be avoided if possible.

Let us take an example of ABAP statement coded in the declaration part of program with a keyword.

Statement Declaration Syntax

The above ABAP statement used to declare variable lv-number of type integer(I) with a value 193(literal). ABAP statement contains a keyword DATA and additions TYPE, VALUE. All elements (keywords, variables, data types and literals) are highlighted in the above diagram of the ABAP statement.

Let us take an example of ABAP statement coded in the processing block of program.

PROGRAM Z_FIRST_PROG.
WRITE 'Hello World, Welcome to TutorialsCampus'.

In the above example, PROGRAM and WRITE are the keywords.

The program displays the list on the screen. In this case, the list consists of 'Hello World, Welcome to TutorialsCampus'.

Statement Declaration Syntax

The above diagram describes the structure of the program and all elements (keywords and literals) are highlighted.

What are types of keywords?

Below are the list of different keyword categories –

  • Declarative Keywords
  • Modularization keywords
  • Control Keywords
  • Call Keywords
  • Operation Keywords
  • Database statements

Declarative Keywords –

Declarative statements use the declarative keywords to declare the data objects that are used by another ABAP statements.

Some of declarative keywords are -

TYPES
DATA
TABLES

Modularization Keywords –

Modularization statements uses modularization keyword to define the processing blocks in ABAP program. The modularization keywords are two types –

Event Keywords –

Event statements uses event keywords to define event blocks. There are no special end statements and automatically ends when another block starts.

Some of event keywords are -

AT SELECTION SCREEN
START-OF-SELECTION
AT USER-COMMAND 

Defining Keywords –

Defining statements uses defining keywords to define subroutines, dialog modules, functional modules, and methods. Defining statements ends with END keywords.

Some of definitive keywords are -

FORM ..... ENDFORM.
FUNCTION ... ENDFUNCTION.
MODULE ... ENDMODULE.

Control keywords -

Control statements uses control keywords to controls the flow of an ABAP program within a processing block based on the specified conditions.

Some of control keywords are -

IF
WHILE
CASE

Call Keywords -

Call statements uses call keywords to call processing blocks. The processing blocks can either be in the same program or in a different program.

Some of call keywords are -

PERFORM
CALL
SET USER-COMMAND
SUBMIT
LEAVE TO

Operational keywords -

Operational statements uses the operational keywords to process the data.

Some of operational keywords are -

WRITE
MOVE
ADD

Database Keywords -

Database statements uses the database keywords to access the tables in the central database system. There are two kinds of database statement in ABAP - Open SQL and Native SQL. Both types of statements use the below DML statements to access the database.

Some of database keywords are -

SELECT
INSERT
UPDATE 
DELETE