Internal Tables - Introduction

 

  • In BW related ABAP, you work mainly with tables. Tables are the essential data structures in the database system.
  • Besides database tables, you can create internal tables which exist only during the runtime of your program.
  • A particularly important use for internal tables is for storing and formatting data from a database table within a program.
  • The data type of an internal table is normally a structure. Each component of the structure is a column in the internal table.
  • The number of lines in an internal table is not fixed. Depending on requirements, the system  increases the size of internal tables at runtime.
  • The data is stored on a row-by-row basis, where each row has the same structure.
  • It has two different parts. Header Line (optional) and Body (Compulsory). Any value that comes to or goes from internal table, that travels through header line.
  • The internal table with header lines are now obsolete.

internal-table

  • You can create explicit work area
  • The statements for the access to individual rows use explicit work area specified.
Declaring Internal Tables

Method 1

TYPES BEGIN OF TY_FLY,

           CARRID TYPE SPFLI-CARRID,

           CONNID TYPE SPFLI-CONNID,

           CITYFROM TYPE SPFLI-CITYFROM,

            CITYTO TYPE SPFLI-CITYTO,

END OF TY_FLY.

DATA WA TYPE TY_FLY.

DATA ITAB TYPE TABLE OF TY_FLY.

Method 2

DATA WA TYPE SPFLI.

DATA ITAB TYPE TABLE OF SPFLI.

In the above two methods, WA is the work area defined for internal table ITAB.

Method 3

TABLES SPFLI.

DATA ITAB TYPE TABLE OF SPFLI.

In this method TABLES SPFLI statement creates an Implicit Header Line for Database table SPFLI. But it can be used as explicit header line for internal table ITAB.

 

Comments

Popular posts from this blog

Domains and Data Elements

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

OPEN SQL EXAMPLES IN ABAP – PART 2