What is Table Type?
Table
types are used to define internal tables. When you create a table type in the
ABAP dictionary, you should specify the line type, access type and key.
Internal
table used to store table data in working memory (RAM) in ABAP. If you are from
Java programming, you can assume it is like a collection.
Suppose
you want toget all the students information whose rating is Good (or) Excellent from
the table ‘ZSTUDENT_RATING’ and store it in an internal table ‘ZSTUDENT_RATING_INTERNAL’.
You
need to set below things while defining table types.
a. Specify the line
type: it is the structure of table type
b. Access mode
c. Set the keys (primary
key and secondary key) to the table type.
What is line type?
It
is any data type from ABAP dictionary, it can be a data element, structure,
table type (or) type of a database table.
How to define line
type?
You
can define line type using existing built in types (CHAR, INT4, DEC etc.,),
ABAP Dictionary types (Data elements, structures, table types, database tables,
views), reference types (Using class or interface).
What is Access mode?
It
specifies how the data is accessed and managed in internal table while
performing CRUD operations. It can be Standard table (Data arranged
sequentially, search is not efficient, since it uses linear search), Hashed
table (Data arranged using hash function, it do not support indexing), Index
table, sorted table (Data arranged using key, search is efficient since it uses
binary search) etc.,
I
am going to show you, how to create table type ‘ZSTUDENT_TT’, to hold student
information using the structure 'ZSTUDENT_STR' that I created in my previous
post.
Creating table type
‘ZSTUDENT_TT’
Use
the transaction ‘SE11’ to open ABAP Dictionary.
Populate
Data type field with ‘ZSTUDENT_TT’ and click on Create button.
Select
the radio button ‘Table type’ and press ok.
It
opens below window.
a.
Update Short description as ‘Table type to store student information’.
b.
Give the Line Type as 'ZSTUDENT_STR'. ‘ZSTUDENT_STR’ is structure I created in
my previous post.
Click
on ‘Initialization and Access’ tab.
Give
‘Initial Number of Rows’ as 25’, it is used to allocate initial memory for an
internal table. This memory will increase dynamically based on number of
records.
Select the Access mode as
‘Standard Table’.
Click
on the save button and activate the table type.
You
can create below table types using the corresponding structures we created in
my previous post.
Table Type
|
Structure
|
ZPARENT_TT
|
ZPARENT_STR
|
ZTEACHING_FACULTY_TT
|
ZTEACHING_FACULTY_STR
|
ZNON_TECHING_FACULTY_TT
|
ZNON_TECHING_FACULTY_STR
|
ZFACULTY_STUDENT_TT
|
ZFACULTY_STUDENT_STR
|
ZSTUDENT_PARENT_TT
|
ZSTUDENT_PARENT_STR
|
ZFACULTY_RATING_TT
|
ZFACULTY_RATING_STR
|
ZSTUDENT_RATING_TT
|
ZSTUDENT_RATING_STR
|
No comments:
Post a Comment