Vous êtes sur la page 1sur 25

Table Types ,Type Groups and

Database operation
Presented By
Copyright 2013 TATA Consultancy Services Limited

AHD04-AEN08
Charlie Group

TCS CONFIDENTIAL

TABLE TYPE
A Table Type is used to describe the structure and
functions of attributes of internal table in ABAP.
A table type is defined by:
It's line type that defines structure and data type
attributes of a line in internal table.
The options of managing and accessing the data
in internal table.
The primary key and secondary key of internal
table.
2
TCS CONFIDENTIAL

INTERNAL TABLE
It is a data structure that exists only at
program run time.
It is a dynamic sequential dataset in which
all records have the same structure and a key.
It is used as a arrays.
You can read individual records of internal
table using either the index or the key using
READ statement.
You can also loop the internal table to read
all the records one by one.

HIERARCHY

STANDARD TABLE
Contains linear index.
Accessed using index or key.
Key can be Unique or non unique.
Search is according to the linear relationship.

SORTED TABLE
Always sorted by a key,
Also contains linear index
Accessed using key or index
Key can be unique or non unique.
Search is done using the binary search algorithm.

HASHED TABLE
Always sorted by a key
Does not contains a linear index
Accessed only through key.
Key is always Unique.
Search is done using the hash algorithm.

TYPE GROUPS (Continued...)

ABAP Dictionary Objects.


Names are limited to five characters.
Name must begin with the type group name and an
underscore
Available type groups in SAP:
1.SLIS
2.ABAP

ABAP DICTIONARY

10

IMPLEMENTATION

11

IMPLEMETATION(Continued..
.)

12

IMPLEMETATION(Continued..
.)

13

Continued...

14

Database operations
INSERT
DELETE
UPDATE
MODIFY
FETCH

15

Use of type group

16

Continued...

17

18

Continued...

19

INSERT
Inserts a single row or a selection of rows into
the table.
SYNTAX :
INSERT INTO <target_db_tab> <db_tab_lines>
INSERT INTO <target_db_tab> FROM <work_area>
EXAMPLE : add an Eastern Sales department to the
database:
INSERT INTO Departments
(Department_ID, Department_Name,
Department_HeadID)
VALUES (600, 'Eastern Sales', 501)

20

UPDATE
The UPDATE statement allows one or more
existing records in a table to be modified at the
same time.
SYNTAX :
UPDATE <target_db_tab> set <data_tab_lines>
where
UPDATE <target_db_tab> from <work_area>
EXAMPLE :
Update zemp_data set empadd= 'sector 7', city=
'AHD' where empid= '01'.
21

MODIFY
The MODIFY statement inserts one or more
rows specified in source in the database table.
SYNTAX :
MODIFY <target_db_tab> FROM <work_area>.
EXAMPLE :
MODIFY zemp FROM wa_emp.

22

DELETE
The statement DELETE deletes one or more
rows from the database table or classic view
specified in target.
SYNTAX :
DELETE <target_db_tab> FROM <work_area>.
EXAMPLE :
DELETE zemp FROM wa_emp.

23

FETCH
The FETCH NEXT CURSOR statement is used to
retrieve data from database.
SYNTAX :
FETCH NEXT CURSOR <c> INTO <target>.
EXAMPLE :
FETCH NEXT CURSOR c2 INTO
CORRESPONDING FIELDS OF work_area2.

24

ANY QUERIES?

Copyright 2013 TATA Consultancy Services Limited

25
TCS CONFIDENTIAL

THANK YOU!

26

Vous aimerez peut-être aussi