You are on page 1of 7

6/22/2014 ABAP Statement Key words and Data Types in SAP - Free SAP Tutorials

http://www.freesaptutorials.com/sap/abap-statement-key-words-and-data-types-in-sap/ 1/7


SAP R/3
Why SAP?
About SAP
Catalog
Posts (RSS)
Comments (RSS)
ABAP Data Dictionary
ERP
SAP
SAP Code
SAP table operation
Screenshots
String
Transaction
ABAP Statement Key words and Data Types in SAP
Tags: ABAP Dictionary , ERP , SAP ERP - Categories: ABAP Data Dictionary, ERP, SAP
ABAP/4 Advanced Business Application Programming Language.
4 4
th
Generation Language.
It is Not Case Sensitive.
Is Event Driven Programming Language.
This overview describing applications programming in the R/3 System. All applications programs, along with parts of the R/3 Basis
system, are written in the ABAP Workbench using ABAP, SAPs programming Language. The individual components of
application programs are stored in a special section of the database called the R/3 Repository. The R/3 Repository serves as a central
store for all of the development objects in the R/3 System. The following sections of this documentation cover the basics and
characteristics of application programming.
A Advanced
B Business
A Application(s)
P Programming
Program :
A Program Is Group Of Meaningful Instructions.
An Instruction is Group of
Keywords + Variables + Operators + Data Types
6/22/2014 ABAP Statement Key words and Data Types in SAP - Free SAP Tutorials
http://www.freesaptutorials.com/sap/abap-statement-key-words-and-data-types-in-sap/ 2/7
Keywords :
Syntax : Each ABAP statement Should begin with a keyword and ends with a period.
Since Each Statement Should Start with a Keyword. It is Difficult to give the exact no. of Keywords So that Keywords are Divided into
Different Types Depends On the Functionality Of the Keywords.
Types Of Keywords :
Declarative Key words : To Declare Variables.
TYPES, DATA, TABLES
Syntax for Variables : DATA < Var. Name> TYPE <Data Types>.
Database Keywords : To Work With Database Operations Such as
SELECT To Select Data
INSERT To Insert Data
UPDATE To Change Data
DELETE To Delete Data etc.
Control Keywords :
Statements are used to control the flow of an ABAP program within a processing block according to certain conditions.
Ex :
IF, ELSEIF, ENDIF.
DO-ENDDO, WHILE ENDWHILE.
Definition Keywords are used to define Re-usable Modules (Blocks)
Ex :
FORM ENDFORM
FUINCTION ENDFUNCTION
MODULE ENDMODULE
Calling Keywords :
Are used to call Re-usable Modules (Blocks) that are already defined.
PERFORM to Call FORM
CALL FUNCTION to Call FUNCTION
MODULE to Call MODULE
Operational Key Words :
To Process the data that you have defined using declarative statements.
Ex : WRITE, MOVE, ADD
6/22/2014 ABAP Statement Key words and Data Types in SAP - Free SAP Tutorials
http://www.freesaptutorials.com/sap/abap-statement-key-words-and-data-types-in-sap/ 3/7
Event Keywords :
Statements containing these keywords are used to define event blocks.
Ex : TOP-OF-PAGE To Print the Same Heading On the TOP Of Every Page.
END-OF-PAGE To Print the Same FOOTER for every Page on the Output List.
Date Types and Objects (Variables)
The physical units with which ABAP statements work at routine are called internal program data objects. The contents of a data occupy
memory space in the program. ABAP statements access these contents by addressing the name of the data object. Each ABAP data
objects has a set of technical attributes which are fully defined at all times when an ABAP program is running. The technical attributes of
a data object are : Data Type, Field Length and Number of Decimal Places.
ABAP Contains the following Pre-defined Data Types :
Non-Numeric Data Types :
Character String (C)
Numeric Character String (N)
Date (D)
Time (T)
Numeric Types :
Integer (I)
Floating-point number (F)
Packed Number (P)
The Field Length for data types D, F, I and T is fixed. The field length determines the number of bytes that the data object occupies in
memory. In types C, N, X and P, the length is not part of the type definition. Instead, you define it when you declare the data
object in your program.
Data Type P is particularly useful for exact calculations in a business context. When you define an object with type P, you also specify a
number of decimal places.
You can also define your own elementary data types in ABAP using the TYPES statements. You base these on the predefined data
types. This determines all of the technical attributes of the new data type. For example, you could define a data type P_2 with two
decimal places on the predefined data type P. You could then use the new type in your data declarations.
Predefine Elementary ABAP Types : All field lengths are specified in bytes.
Data Types Initial Field Length Valid Field
Length
Initial Value Meaning
Numerica Types
I 4 4 0 Integer (Whole Number)
F 8 8 0 Floating Point Number
6/22/2014 ABAP Statement Key words and Data Types in SAP - Free SAP Tutorials
http://www.freesaptutorials.com/sap/abap-statement-key-words-and-data-types-in-sap/ 4/7
P 8 1
16
0 Packed Number
Character (Non-Numeric) Types
C 1 1
6553
5
.. Text Field
(Alphanumeric Characters)
D 8 8 00000000 Date Field
(Format : YYYYMMDD)
N 1 1
6553
5
0 0 Numeric Text Fields
(Numeric Characters)
T 6 6 000000 Time Field
(Format : HHMMSS)
Note : Data Type N is not a numeric type. Type N objects can only contain number characters (0.9) but are not represented
internally as numbers. Typical type N fields are account numbers and zip codes.
Integers Type 1
The value range of type 1 numbers is -2**31 to 2**31-1 and includes only whole numbers. Non-integer results of arithmetic operations
(e.g. fractions) are rounded, not truncated.
You can use type 1 data for counters, number of items, indexes, time periods, and so on.
Packed Numbers Type P
Type P data allows digits after the decimal point. The number of decimal places is generic, and is determined in the program.
The value range of type P data depends on its size and number of digits after the decimal point. The valid size can by any value from
1 to 16 bytes. Two decimal digits are packed into one byte, while the last byte contains one digit and the sign. When working with
type P data, it is a good idea to set the program attributes Fixed point arithmetic. Otherwise, type P numbers are treated as
integers.
Note : You can use type P data for such values as distances, weights, amounts of money, and so on.
Floating Point Numbers Type F
The value ranges of type F numbers is 110**-307 to 110**308 for positive and negative numbers, including 0 (zero). The accuracy
range is approximately 15 decimals, depending on the floating point arithmetic of the hardware platform. Since type F data is internally
converted to a binary system, rounding errors can occur. Although the ABAP processor tries to minimize these effects, you should not
use type F data if high accuracy is required. Instead, use type P data.
You use type F fields when you need to cope with very large ranges and rounding errors are not critical.
6/22/2014 ABAP Statement Key words and Data Types in SAP - Free SAP Tutorials
http://www.freesaptutorials.com/sap/abap-statement-key-words-and-data-types-in-sap/ 5/7
Using I and F fields for Calculations is quicker than using P fields.
Operations using I and F fields are very similar to the actual machine code operations, while P fields requires more support from the
software. Nevertheless, you have to use type P data to meet accuracy or value range requirements.
Character (Non-Numeric) Types :
Of the five non-numeric types, the four types C,D, N and T are characters types. Fields with these types are known as character
field. Each position in one of these fields talks up enough space for the code of the character. Currently, ABAP only works with single-
byte codes such as ASCII and EBCDI. However, an adaptation to UNICODE is in preparation. Under UNICODE, each character
occupies two or four bytes.
Related posts:
1. Advantage of Domains and Data Elements in SAP
2. ABAP Dictionary objects : ABAP tables
3. ABAP Dictionary in SAP
4. Steps to create table in data dictionary (DDIC) in SAP
5. What are structures in ABAP : use of move statement
Working With Structures in SAP
Create First ABAP Program In SAP
Leave a Reply
Name (required)
Mail (will not be published) (required)
Open-Source COBOL
esiusa.com/cobol-it.aspx
Eliminate COBOL license fees! Full
support, open-source COBOL-IT.
6/22/2014 ABAP Statement Key words and Data Types in SAP - Free SAP Tutorials
http://www.freesaptutorials.com/sap/abap-statement-key-words-and-data-types-in-sap/ 6/7
More Entries
Advantage of Domains and Data Elements in SAP
What are structures in ABAP : use of move statement
ABAP Dictionary in SAP
Steps to create table in data dictionary (DDIC) in SAP
Create First ABAP Program In SAP
Categories
ABAP Data Dictionary
ERP
SAP
SAP Code
SAP table operation
Screenshots
String
Transaction
Recently Added
SAP LSMW
innowera.com/sapl
Load from Excel
without coding. Map
& Shoot to
Transaction or BAPI
6/22/2014 ABAP Statement Key words and Data Types in SAP - Free SAP Tutorials
http://www.freesaptutorials.com/sap/abap-statement-key-words-and-data-types-in-sap/ 7/7
How to use chain operator ABAP SAP
How to use System Variables ABAP SAP
How to use Arithmetic Operators using PARAMETER : ABAP SAP
Create First ABAP Program In SAP
ABAP Statement Key words and Data Types in SAP
Working With Structures in SAP
Example to Create Maintain Table in SAP
Advantage of Domains and Data Elements in SAP
Steps to create table in data dictionary (DDIC) in SAP
ABAP Dictionary in SAP
Type of ABAB Internal Tables : SAP ABAB Tables
Example for all Internal table operation
ABAP Operation on Internal Tables
Steps for Declaring Internal table
Internal table in ABAP: Declaration of Work area
Useful Links
Copyright SAP Tutorials

You might also like