Chapter 06 Review of Concepts-Work Areas & Internal Tables

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 11

IBM Global Business Services

Review of Concepts: Work Areas & Internal Tables

Review of Concepts: Work Areas & Dec-2008 IBM Corporation 2013


Internal Tables | 4.06
IBM Global Business Services

Objectives

The participants will be able to:


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

2 Review of Concepts: Work Areas & Internal Tables | 4.06 Dec-2008 IBM Corporation 2013
IBM Global Business Services

Review of Concepts : Table Work Areas

The ABAP TABLES statement LFA1 WORK AREA


creates a work area for each of the
tables mentioned.

BSIK WORK AREA

3 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

CHECK
SELECT * 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

CHECK
SELECT * SY-SUBRC

DATA
SOURCE

RECORD # 2

RECORD # 1
No Longer Available LFA1 WORK AREA

5 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
INTERNAL TABLE SOURCE

RECORD # 1 RECORD # 6

RECORD # 2
LFA1 WORK AREA
RECORD # 3

RECORD # 4 When an ABAP programmer


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

APPEND ITAB

6 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 INTERNAL TABLE

RECORD # 1
REFRESH ITAB.
RECORD # 2

RECORD # 3

7 Review of Concepts: Work Areas & Internal Tables | 4.06 Dec-2008 IBM Corporation 2013
IBM Global Business Services

Demonstration

Using Workareas and Internal tables.

8 Review of Concepts: Work Areas & Internal Tables | 4.06 Dec-2008 IBM Corporation 2013
IBM Global Business Services

Practice

Using Workareas and Internal tables.

9 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

You might also like