Professional Documents
Culture Documents
PD rm PD rm
Y Y
Y
Y
er
er
ABB
ABB
y
y
bu
bu
3.0
3.0
to
to
re
re
[Pick the date]
he
he
k
k
lic
lic
C
C
w om w om
w
w
w. w.
A B B Y Y.c A B B Y Y.c
Y
er
er
ABB
ABB
y
y
bu
bu
3.0
3.0
to
to
re
re
he
he
k
k
lic
lic
Created by Tanumoy Mistri 2w . A B
C
C
w om w m
w
w
w.
A B B Y Y.c co
B Y Y.
Internal Tables
Internal table is a temporary table which is stored in RAM on the application server. It is created and filled by a
program during execution and is discarded when the program ends.
Definition of Internal table: An internal table consists of a header line and body.
Header Line: A header line is a field string with the same structure as a row of the internal table. It can only
hold a single row. It’s used as a buffer while data is inserted to internal table or retrieved from the internal
table.
end of <internal_table_name>.
From the above code, we use begin of to define an internal table with header line. If we use with header line,
we define an internal table with a header line.
F T ra n sf o F T ra n sf o
PD rm PD rm
Y Y
Y
Y
er
er
ABB
ABB
y
y
bu
bu
3.0
3.0
to
to
re
re
he
he
k
k
lic
lic
Created by Tanumoy Mistri 3w . A B
C
C
w om w m
w
w
w.
A B B Y Y.c co
B Y Y.
Here, we use occurs n to define the body of the internal table. When the first row is added to the internal
table, memory is allocated for the internal table.
Work Area: Work area is a field string having the same structure as a row of an internal table. Work area is
also acting like a buffer while adding data to or retrieving data from internal table. There are two types of
work areas are there: 1) Explicit Work Area
Any field string having the same structure as a row of an internal table can be used as an Explicit Work Area.
If any work area is not defined, the Implicit Work Area is used.
To add a single row to an internal table, we use append statement. append copies the single row of the work
area or the header line and places it at end of the existing rows of the internal table body.
Syntax: 1) append it. This statement implies that, it copies the single row of the header line it and
places it at the end of the existing rows of the internal table body.
3) append wa to it. This statement implies that, it copies the single row of the explicit work area
wa and places it at the end of the existing row of the internal table body.
4) append initial line to it. This statement appends the initial line i.e. blanks and zeros to the
Y
er
er
ABB
ABB
y
y
bu
bu
3.0
3.0
to
to
re
re
he
he
k
k
lic
lic
Created by Tanumoy Mistri 4w . A B
C
C
w om w m
w
w
w.
A B B Y Y.c co
B Y Y.
REPORT ZDAY11_PROG6.
it-f1 = 1.
it-f2 = 'AAAA'.
append it to it.
write: /'Sy-tabix: ', sy-tabix.
it-f1 = 2.
it-f2 = 'BBBB'.
append it.
write : /'Sy-tabix: ', sy-tabix.
Output:
Sy-tabix: 1
Sy-tabix: 2
Analysis : In this program, we declare an internal table named it. The components of the internal table are f1
and f2 of type ‘n’ and ‘c’. The statement it-f1 = 1. and it-f2 = ‘AAAA’. fills the header line it. Here it refers to
the header line of the internal table. The statement append it to it. states that, data of the header line it is
appended at the first row of the internal table it. For this reason, the next statement write: /’Sy-tabix’, sy-
tabix gives the output 1, where sy-tabix gives current row index. The next statement append it is same as
append it to it.
it-f1 = 1.
it-f2 = ‘AAAA’.
append it to it
Here Sy-tabix is 1.
F T ra n sf o F T ra n sf o
PD rm PD rm
Y Y
Y
Y
er
er
ABB
ABB
y
y
bu
bu
3.0
3.0
to
to
re
re
he
he
k
k
lic
lic
Created by Tanumoy Mistri 5w . A B
C
C
w om w m
w
w
w.
A B B Y Y.c co
B Y Y.
it-f1 = 2.
it-f2 = ‘BBBB’.
append it to it
REPORT ZDAY11_PROG7.
wa-f1 = 1.
wa-f2 = 'AAAA'.
append wa to it.
wa-f1 = 2.
append wa to it.
Sy-tabix: 2
Analysis : In this program, we declare an internal table named it. The components of the internal table are f1
and f2 of type ‘n’ and ‘c’. We also declare a work area wa like the internal table it using wa like it statement.
The statement it-f1 = 1. and it-f2 = ‘AAAA’. fills the work area wa. The statement append wa to it. states that,
data of the work area wa is appended at the first row of the internal table it. For this reason, the next
statement write: /’Sy-tabix’, sy-tabix gives the output 1.
The next statement wa-f1 = 2 changes the content of the f1 component but content of f2 remain same.
F T ra n sf o F T ra n sf o
PD rm PD rm
Y Y
Y
Y
er
er
ABB
ABB
y
y
bu
bu
3.0
3.0
to
to
re
re
he
he
k
k
lic
lic
Created by Tanumoy Mistri 6w . A B
C
C
w om w m
w
w
w.
A B B Y Y.c co
B Y Y.
wa-f1 = 1.
wa-f2 = ‘AAAA’.
append wa to it
Here Sy-tabix is 1.
wa-f1 = 2.
append wa to it
Here Sy-tabix is 2.
REPORT ZPRACTICE1 .
it1-f1 = 2.
it1-f2 = 'BBBB'.
it1-f3 = 002.
F T ra n sf o F T ra n sf o
PD rm PD rm
Y Y
Y
Y
er
er
ABB
ABB
y
y
bu
bu
3.0
3.0
to
to
re
re
he
he
k
k
lic
lic
Created by Tanumoy Mistri 7w . A B
C
C
w om w m
w
w
w.
A B B Y Y.c co
B Y Y.
append it1.
it1-f1 = 3.
it1-f2 = 'CCCC'.
it1-f3 = 003.
append it1.
loop at it1.
write : / it1-f1,
it1-f2,
it1-f3.
endloop.
it2-g1 = 1.
it2-g2 = 'AAAA'.
it2-g3 = 001.
append it2.
loop at it2.
write : / it2-g1,
it2-g2,
it2-g3.
endloop.
Output:
2 B2
3 C3
1 A1
2 B2
3 C3
1) loop at.
2) read table.
Y
er
er
ABB
ABB
y
y
bu
bu
3.0
3.0
to
to
re
re
he
he
k
k
lic
lic
Created by Tanumoy Mistri 8w . A B
C
C
w om w m
w
w
w.
A B B Y Y.c co
B Y Y.
We commonly use loop at statement to read multiple rows from an internal table. loop at statement reads
multiple rows from an internal table and places them into a work area.
-----
endloop.
-------
endloop.
--------
endloop.