Declarative Statements in ABAP

 These statements define data types or declare data objects which are used by the other statements in a program or routine.

Ex:

TYPES, DATA, TABLES, CONSTANTS, FIELD-SYMBOLS, PARAMETERS, SELECT-OPTIONS

Constants  This keyword is for declaring constant identifiers.

CONSTANTS PI TYPE P DECIMALS 3 VALUE '3.147'.

Constants cannot be modified in the further program.

Field-Symbols These are similar to pointers in C language. Used for referring to any type of data object in a program.

FIELD-SYMBOLS: <FS1>, <FS2>.

DATA:  A TYPE I, str(20) TYPE C.

ASSIGN  A TO <FS1>.

WRITE <FS1>.    //Value of A will be displayed

ASSIGN STR TO <FS1>.

WRITE <FS1>.   //Value of STR will be displayed.

Types This keyword is used to define new user defined data types.

TYPES FLOATING TYPE P DECIMALS 6.

DATA A TYPE FLOATING.

DATA B TYPE FLOATING.

Tables This keyword is used to create a structure in RAM corresponding to a database table.

TABLES: mara, vbrk.

Type-Pools This keyword is used to attach a Data Dictionary (DDIC) type group to the current program. Type Group is a central repository object that maintains definitions of user defined data types.

TYPE-POOLS SLIS.              //Used in ALV Reporting

TYPE-POOLS SSCRFIELDS.     //Used for selection screen.

 

Courtesy: ABAP Technical Documentation

Comments

Popular posts from this blog

Sample ABAP program for Updating notepad file data to Internal table and Sending it to Application server

OPEN SQL EXAMPLES IN ABAP – PART 2

Domains and Data Elements