ABAP Programming Basics 1725044345
ABAP Programming Basics 1725044345
Note :- A statement is sequence of words and every statement ends with dot(.) sign in ABAP.
After saving the program we must use Ctrl + F2 for syntax check and Ctrl + F3 to execute
the program.
Display object list :- We can navigate to SE80 transaction code from our program after click
on display object list.
Activation :- Ctrl + F3
Execute :- F8
Display/Change :- Ctrl + F1
Indentation
Comments are ignored when the program is generated by the ABAP compiler.
The * character at the start of a program line indicates that the entire line is comment.
The “character, which can be entered at any position in the line, indicates that the remaining
content in the line is a comment.
*******************
*Examples of if statement
if sy-subrc eq 0.
************
Note :- Don’t worry, much about the code at this moment, just try to understand how things are
going, it will get easier to understand with time.
As you can see, in the above code, how we have used * and “ to use single line comments.
For commenting and uncommenting multiple lines at the same, select all the lines and press
Ctrl + , to comment and Ctrl + . to uncomment.
A data types defines the technical attributes ( types and length ) of data objects.
Data types can be defined independently in the ABAP program or in ABAP Dictionary.
Data Objects :-
A data object is an instance of a data type.
It occupies the memory space based upon the data type specified.
*******************************
*Example:-
DATA lv_empid(20) type n,
lv_empid = 10.
*******************************
Elementary types
Complex types
Reference types
1. Elementary Types :-
They are predefined data types
2. Table Type
2. Object reference
*********************************
*Example:-
lo_object type ref to ZCLASS.
**********************************
In the above syntax - lo_object = Name of the data object, TYPE REF TO = keyword,
ZCLASS = name of already existing class.
Numeric Literals :- Numeric Literals have sequence of numbers. Examples - 123, -4567
etc.
1. Variable
2. Constants
3. Text Symbols.
Variables :-
Variables are data objects whose contents can be changed.
***************************
*Example :-
DATA lv_empid(20) type n.
lv_empid = 10.
lv_empid = 20.
****************************
********************************
*Example
CONSTANTS lc_pi type p decimals 3 value '3.141'.
*********************************
Text Symbols :-
A text symbol is data object that is not declared in the program itself.