Hi, I provide training in SAP UI5. Also feel free to checkout my new web page https://saptechblog.com
ABAP

Structure of an ABAP program

 

The structure of an ABAP program is as below:

image

Each and every word must be separated at least by 1 space.

The code till the ‘Period’ (DOT) is considered as a statement.

 

Example of an ABAP Statement:

image

DATA

The ABAP statement begins with the keyword of what we are going to do. In this example Data is a keyword which is going to declare the variable

GV_RESULT

GV_RESULT is an operand which represents the name of the variable created.

TYPE

Type is also an keyword which indicates what is the type of data going to be created.

I

I is a data type that was predefined indicates the variable created is of type integer.

 

Indention:

A code can be indented as per your wish or it can be written in multiple lines. According to a compiler, a statement starts with a keyword and ends with a period.

image

 

Case Sensitivity:

ABAP program is not case sensitive. Which means you can write your code in upper letter or lower letter of your choice. Mixing of words is also allowed.

Gv_result and GV_RESULT is the same data object.

 

Chained Statement:

A single keyword can be used to represent multiple statements. It is called chained statement.

image

It is better to use the chain statements if you are going to create multiple data.

 

How Normal statements are executed?

First the compiler read the keyword data, decompiles it and prepares for variable creation. When it encounters period it knows the variable creation has done and resets.

Again in the next line when it reads data, it once again decompiles the data keyword and prepares for variable creation.

 

How Chained statement works?

When the compiler reads the data keyword it prepares for variable creation, after creating the variable here it does not encounter a period instead it reads the value ‘comma’ this tells the compiler the next operation is also going to be the same what you did now so don’t refresh yourself. In this way it keeps on performing the same operation until it encounters a period.

 

Comment:

Any programming language comment is the important thing. This helps the programmer to make comment of what he has done. This will help the other fellow developers to know what he has done.

 

Star ‘*’ is used in the beginning of the line to represent a comment. This will tell the compiler that this is a dummy statement which is not to be executed.

If you wanted to make some comment in end of the line then double quotation marks, can be used to indicate the compiler following is a comment.

 

image

Documentation of Keyword:

Every keyword in ABAP has been documented of how it can be used. To know more of it position the cursor on the keyword and press F1 to read the documentation of the keyword.

image

 

 

About Arun

0 Comments:

Post a Comment

Powered by Blogger.