ABAP is a programming language that runs in the SAP ABAP Runtime environment, created and used by SAP for the development of application programs including Reports ,Module Pool Programming, Interfaces, Forms , Data conversions ,User Exits & BADI.
All of R/3’s applications and even parts of its basis system were developed in ABAP. ABAP is an event-driven programming language. User actions and system events control the execution of an application. ABAP is also called ABAP/4. The “4” in ABAP/4 stands for “Fourth Generation Language” or 4GL.
ABAP WORKBENCH
The ABAP Workbench is used by SAP for the development of standard and custom application software. The ABAP Workbench is also used to create dictionary objects.
It consists of the following components −
1. ABAP Editor is used to maintain programs.
2. ABAP Dictionary is used to maintain Dictionary objects.
3. Repository Browser is used to display a hierarchical structure of the
components in a package.
4. Menu Painter is used to develop graphical user interfaces including menu
bars and toolbar's.
5. Screen Painter is used to maintain screen components for online programs.
6. Repository Information System contains information about development and
run time objects, such as data models, dictionary types and table structures,
programs,and functions.
7. Test and Analysis Tools, such as the Syntax Check and the Debugger.
8. Function Builder, which allows to create and maintain function groups and
function modules.
9. Data Modeler, a tool which supports graphical modeling.
10.Workbench Organizer, which maintains multiple development projects
and manages their distribution.
Operators in SAP ABAP
In the abap we have 3 types of operators
1.Mathematical Operator
2.Comparative Operator
3.Relational (or) Logical Operator
1. Mathematical Operator:
• Basic operations : +,-, / and * along with functions like sin, sqrt etc. are
Supported
• Priority of the operations : functions , exponential , multiplication
division ,addition , substraction.
2. Comparative Operator :-
3. Relational (or) Logical Operator :-
Comments in SAP ABAP :-
1.Comments are the non-executable statements these are used to improve
the readability of the program
2.If we want to comment the entire line then we place * at the first character of
the line
*----------------------------------------
3.If we want to comment the line we use “
Ex: c = a + b “Adding a and b
Data Types and Data Objects in ABAP :-
Data Types in abap:-
1.Data types are pure descriptions.
2.There is no memory associated with data types.
3.Data types describe the technical properties of data objects
ABAP Data types can be divided into elementary, reference, and complex types.
1 . Elementary Types: – They are data types of fixed or variable length
that are not made up of other data types. In variable data types the
memory space used by the data objects changes dynamically during
runtime and their definitions can be altered later. This is not so with
fixed length data types.
In predefined data types, you are allowed to define
elementary data types on your own in ABAP by making use of the
TYPES statement. You base these on the predefined data types. You
can define your own technical attributes.
2. Reference Types: – These data types describe reference variables, which
are data objects that have references in them. Reference variables are
components of a complex data object like structures or internal tables.
3. Complex Data Types: – Complex data types are those that are made
up of other data types. They are of two types – structured types and table
types.Structures are used to group together work areas that logically
belong together. The various elements of a structure may be of any
type, or can be a different structure or internal Structures may be
classified as Nested and non- nested structures or Flat and deep structures.
Nested structures contain one or more other structures as components,
unlike non-nested structures. Flat structures contain only elementary data
types of fixed length. Deep structures contain at least one internal table,
reference type, or a string as a component.
Internal tables may contain a series of lines that are all of
the same data type. Internal tables have a line type, which is used to
identify table rows using a unique or non- unique key and a table type that
determines just how individual table entries, whether non- sorted, sorted
index tables or hash tables are accessed.
Data objects :-
1.Data objects are the physical units a program uses at runtime.
2.Each data object has a specific data type assigned to it.
3.Each data object occupies some space in memory.
The various data objects in ABAP are:
1 .Literals: – Literals exist in the program source code and have a fixed
technical attribute such as field length, number of decimal places and data
type. But literals are nameless.
2. Named Data Objects: – They are data objects that have a name using
which you may address the ABAP program. They include text symbols,
constants and variables.Text symbols are nothing but pointers to texts
present in the text pool.Variables are data objects which have contents
that may be changed in an ABAP program using program statements. To
declare variables, you should use statements such as DATA, CLASS-DATA,
STATICS, PARAMETERS, SELECT -OPTIONS, and RANGES. Constants are data
objects whose contents cannot be changed.
3. System-Defined Data Objects: –System- defined data objects are available
at run- time always and don’t have to be declared explicitly .
4. Interface Work Areas: – Interface work areas work as interfaces
between programs, screens,and logical databases and are declared with
statements such as TABLES and NODES.
5. Objects: – They are anonymous data objects that are nameless and
declared using CREATE OBJECT command.
Control Statements :-
This are used to control the flow of execution of the program Controlling the Flow of ABAP/4 Programming:
The flow of an ABAP/4 program can be controlled internally and externally.
Internal control is steered by using some standard control keywords( IF,CASE, DO,WHILE).
Control structures are 2 types :-
1.Branching Control structures(IF,CASE)
2.Looping Control structures(DO,WHILE).
External control is steered by events . Events are generated either from other ABAP/4 programs (system programs or user programs) or from interactive user input (like, for example, using the mouse to click on the screen).
Programming Logical Expressions
Use logical expressions in conditions statements with key words
IF, CHECK and WHILE to compare data fields.
comparisons with all field types
comparisons with character strings and numeric strings
Comparisons with all field types:
Use following operators in logical expressions for comparisons
with all field types
EQ(=)
NE(<> or ><)
LT(<)
LE(<=>)
GT(>)
GE(>=)
TYPE and LIKE in ABAP :-
TYPE : It will allocate memory during execution (object type)
TYPE will improve performance.
It is used when user defined object link with SAP system data type.
TYPE refers to the user defined data types
TYPE,assign datatype directly to the data object while declaring.
LIKE : Tt will allocate memory immediatly.
It is when data object link with the other data object.
LIKE refers to existing data type of data object
LIKE,you assign the datatype of another object to the declaring data
Object. The datatype is referenced indirectly.
Text Elements :-
Text elements are used to store texts displayed on the selection screens or output screens of ABAP reports, but are not hard-coded in programs. The different types of text element include:
A field string is a type of variable, and is the equivalent of a structure in the DDIC but is defined within an ABAP/4 program. Like a structure, a field string is a series of fields grouped together under a common name. The difference lies mainly in where the definition resides. The term structure in R/3 applies only to a Data Dictionary object containing a collection of fields. The term field string applies to a collection of fields defined in an ABAP/4 program.
Two statements are usually used to define field strings in an ABAP/4 program:
Syntax for Defining a Field String Using the DATA Statement
The following is the syntax for defining a field string using the data statement.
f1[(l)] [type t] [decimals d] [value 'xxx'],
f2[(l)] [type t] [decimals d] [value 'xxx'],
1. … AT pl (position and length specification,before the field)
2. … option (formatting option)
3. … ofmt (output format by field)
4. … AS CHECKBOX (output as checkbox)
5. … AS SYMBOL (output as symbol)
6. … AS ICON (output as icon)
7. … AS LINE (output as line)
Outputs the field f in the correct format for its type to the current list. The field f can be:
a field declared by DATA ,
a component of a structure declared by TABLES ,
a field symbol (FIELD-SYMBOLS ),
a text literal which is not language-specific
a language-specific text literal (text symbol).