Sie sind auf Seite 1von 11

IBM Global Business Services

Review of Concepts: Work Areas & Internal Tables

Review of Concepts: Work Areas &


Internal Tables | 4.06

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Objectives

The participants will be able to:


Recall the concept of work area.
Recall the concept of Internal tables.

Review of Concepts: Work Areas & Internal Tables | 4.06

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Review of Concepts : Table Work Areas

LFA1 WORK AREA

The ABAP TABLES statement


creates a work area for each of the
tables mentioned.

BSIK WORK AREA

Review of Concepts: Work Areas & Internal Tables | 4.06

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Review of Concepts : Retrieving Data from Database Into


Table Work Area
SELECT *

CHECK
SY-SUBRC
The ABAP SELECTENDSELECT
statement takes data from the specified
table (data source) and places it, one
record at a time, into the work area.

DATA
SOURCE
RECORD # 1

LFA1 WORK AREA


4

Review of Concepts: Work Areas & Internal Tables | 4.06

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Review of Concepts : Replacement of Table Work Area


Contents

SELECT *

CHECK
SY-SUBRC

DATA
SOURCE
RECORD # 2
RECORD # 1
No Longer Available
5

LFA1 WORK AREA

Review of Concepts: Work Areas & Internal Tables | 4.06

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Review of Concepts : Using Internal Tables to Capture


Incoming Data
DATA
SOURCE

INTERNAL TABLE
RECORD # 1

RECORD # 6

RECORD # 2
LFA1 WORK AREA
RECORD # 3
RECORD # 4

When an ABAP programmer


creates an internal table the
data is not lost. It remains
available to the
programmer.

RECORD # 5

APPEND ITAB

Review of Concepts: Work Areas & Internal Tables | 4.06

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Review of Concepts : Keywords in Emptying Work Areas

BEFORE

AFTER

RECORD # 3
CLEAR LFA1.
LFA1 WORK AREA

LFA1 WORK AREA

INTERNAL TABLE
RECORD # 1

INTERNAL TABLE
REFRESH ITAB.

RECORD # 2
RECORD # 3

Review of Concepts: Work Areas & Internal Tables | 4.06

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Demonstration
Using Workareas and Internal tables.

Review of Concepts: Work Areas & Internal Tables | 4.06

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Practice
Using Workareas and Internal tables.

Review of Concepts: Work Areas & Internal Tables | 4.06

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Summary
TABLES statement in ABAP creates a workarea for the database table specified.
Workareas can hold only one record during the program execution whereas, an
Internal table can hold multiple records at a time.
For the above reason, when we have to retrieve multiple entries from the
database, we should be using internal tables instead of an workarea. Because
use of workarea will mean we have get the data from database multiple times.
CLEAR statement deletes the content of workarea. It can be used to initialize the
header line of an internal table as well.
REFRESH statement wipes off the contents of the internal table.

10

Review of Concepts: Work Areas & Internal Tables | 4.06

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Questions
What is the difference between a workarea and an internal table ?
Which of these (workarea vs. Internal table) is better to use in our program when
we need to retrieve multiple records ?
What are the statements to initialize workareas and internal tables ?

11

Review of Concepts: Work Areas & Internal Tables | 4.06

Dec-2008

IBM Corporation 2013