ABAP Keywords


What is ABAP Keywords?


When you want to learn a language each language having elementary keywords same way first element of ABAP statement is known as ABAP keywords. A keyword determines the ABAP categories.


ABAP keywords are the vocabulary of SAP ABAP Programming language. Any ABAP statements are composed of keywords, operands, and operators according to the predefined syntax rules.


ABAP Keywords can also contain hyphens (-) to form multiple word expressions.

Example;

ADD-CORESSPONDANCE

END-OF-FILE

END-OF-PAGE

ABAP keywords are not reserved names. ABAP naming conventions is not restricted, if possible we should avoid.


In a ABAP statement


DATA I_number TYPE I VALUE 211.


Data Keyword

Iv_number Variable

Type Additions

Value Additions

I Data type

VALUE 211 Literal


Structure of a program


Example of ABAP Statement coded


1. PROGRAM_Z_PROG

2. WRITE_’Hi Learner’ Welcome to SastraGeek ABAP Training


In the above ABAP statement PROGRAM and WRITE are the keywords.


The Program displays the list of screen. The list consists of ‘HI Learner’ Welcome to SastraGeek ABAP Training.

Types of ABAP Keywords?

· Declarative Keywords

· Modularization Keywords

· Control Keywords

· Call Keywords

· Operational Keywords

· Database Keywords


1) Declarative Keywords

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

Some Declarative words are


A) Data: Data keyword is one of the declarative keyword. It is used to declare the variable syntax:

Data var_name

Example:

Data X.

We not use keyword data try save the system will give syntax error


B) Type: Type is one of the declarative keyword. It is used to declare data type of the declared variable.

Syntax

Data var_name Type Data Type

Example:

Data X. Type i. (Single variable declaration)

(i-Integral)

Data Name C.

(c-Characters)

· Characters is a single letter

· We need to specify the length also

Data : X Type I,

Name (10) type c,

Address Type String.

( : )- is act as chain operator and (,) – is act continue

Above is multiple variable declarations

If we use string we not need to define character length

1 String 65782 letters


C) Constant: Type is one of the declarative keyword. It is used to declare data type of the constant data type

Syntax

constants x type data i value 10.

constant y type c value welcome to SastraGeek ABAP Training


D) Types: Types is one of the declarative keyword. It is used to declare structure

Business Requirement--> customer (500)--> Customer No Customer Name- Customer Type- Customer Address information display only

Types: begins of structure_name,

End of str_name


E) Tables: Table is one of the declarative keyword. It is used to declare tables

Business Requirement--> Customer (300)--> Customer no-customer name- Customer type----etc. all fields information display

Select * from customer.

Select--> getting

(*) --> All field info

From--> From

db_t--> Customer

If you wish to display any data table in ABAP program we need to declare first the data base table first


2) Modularization Keywords

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


A) 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 keywords are;

1. AT SELECTION SCREEN

2. START-OF-SELECTION

3. AT USER-COMMAND

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


Some definitive keywords are;

1. FROM……END FROM

2. FUNCTION…..END FUNCTION

3. MODULE…..END MODULE


3) Control Keywords

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

Some controls keywords are;

1. IF

2. WHILE

3. CASE

Seven types

1. If---- endif.

2. If----else---endif.

3. If----elseif---endif.

4. case----when---endcase.

5. do-----enddo.

6. while----endwhile.

7. Loop---endloop… ----->internal table concept


Debugging Controlling Key Word


Parameter: It is used to provide the single input values dynamically.

Debugging: It is process of identifying of internal process of program

o Break Point: A break point is an area in an ABAP program where the execution halts and turns on the debugging mode. The control is then transferred to ABAP debugger, which further controls the execution of the program. Break points are classified as

- Normal Breakpoint

- External breakpoint

Breakpoint Locations

1. Conditions.

2. Program logics.

3. Display

4. Select, insert, modify etc.

5. Functional Module.


Types of Message

1. I------ Information

2. S------Success

3. W---- Warning

4. E----- Error

5. A-----Abond


Case when end case

CASE INPUT_VARIABLE.

WHEN INPUT_VARIABLE.

CODING.

WHEN INPUT_VARIABLE.

CODING.

WHEN INPUT_VARIABLE.

CODING.

ENDCASE.


String Operations


1. Concatenate: It is one of the string operations. It is used to add the multiple string values into another string.

2. Split: It is one of the string operations. It is used to split the main value into multiple strings.

3. Condense: It is one string operations. It is used to remove the unwanted space in between the characters of the strings

4. Replace: It is one string operations. It is used to replace the strings.

5. Length: It is one string operations. It is used to find out the length of characters in a particular strings.

6. Translate: It is one string operations. It is used to convert upper case or lower case or lower case to upper case.

7. Substring: It is one string operations.

4) Call Keywords

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

Some call keywords are;

1. PERFORM

2. CALL

3. SET USER-COMMAND

4. SUBMIT

5. LEAVE TO

5) Operational Keywords

Operational statements uses the operational keywords to process the data.

Some operational keywords are;

1. WRITE

2. MOVE

3. ADD


6) Database Keywords

Database statements uses the database keywords to access the tables in the central database system. There are two kinds of data statement in ABAP


A) Open SQL

B) Native SQL


Both type of statement use the below DML statement to access the database. Some database keywords are;

1. SELECT

2. INSERT

3. UPDATE

4. DELETE