ABAP Dictionary
Nov 07, 2014
ABAP Dictionary
Copyright © 2005 Accenture 2
Module Objectives
• Describe the basic functionality of the Data Dictionary, its
objects and related transactions
• Define domain and data element and how they are related
• Define a table and table concepts including:
– Foreign key and primary key
– SAP table types
– Creating and maintaining tables - SE11
– Indexes
– Buffering
• Define structures and views
• Define search help
• Describe the data browser
Copyright © 2005 Accenture 3
What is a Data Dictionary?
• A data dictionary is a system-
independent interface to a
database.
• A data dictionary is a “virtual
database” containing metadata
(data about data).
• A data dictionary provides tools
for data manipulation and data
processing.
Copyright © 2005 Accenture 4
Why a Data Dictionary?
• A data dictionary facilitates the development of platform-independent
applications.
• A data dictionary eliminates the need for programmers to be concerned
about specific storage locations, drive and directory names, etc.
ABAP Dictionary ABAP Dictionary
ABAP
Program X
ABAP
Program X
Unix Windows
NT SAP Database
(Oracle) SAP Database
(MS SQL Server)
Copyright © 2005 Accenture 5
ABAP Dictionary Functionality
• Records
• Storage
• ABAP Dict
Objects
• Where-used
lists
• Relationships
Modification
analysis
• ABAP Dict
Objects
• Time Stamp
Validation
• Entries in
DB Catalog
• ABAP Dictionary
• Repository Info System
• Documentation
AN
ALY
SIS
AC
TIV
AT
ION
INTEGRATION
ADMINISTRATION
Copyright © 2005 Accenture 6
ABAP Dictionary Transactions
• SE80 - Repository Browser
• SE15 - Repository Information System
• SE16 - Data Browser
• SE17 - General Table Display
• SM30 - Maintain Table Views
• SM31 - Table Maintenance
Copyright © 2005 Accenture 7
Basic Data Dictionary Objects
Field
Data Element
Domain Table
uses
uses
Copyright © 2005 Accenture 8
Levels of Abstraction
Domain
Data Element
• Data type
• Number of characters
• Output length
• Value table
• Attributes inherited from domain
• Field labels
Field
Table
• Field name
• Primary key indicator
• Attributes inherited from data element
Copyright © 2005 Accenture 9
Two-Level Domain Concept
S_CITY
S_TO_CITY S_FROM_CIT
Departure
City
Destination
City
Domain
Data
element
City
Copyright © 2005 Accenture 10
Domain
Copyright © 2005 Accenture 11
Specifying Value Ranges for a
Domain
Fixed Values Example:
Value Table Example:
Domain: S_CLASS (Classes for a Flight Booking)
Values: C (business class)
F (first class)
Y (economy class)
Domain: S_CARR_ID (Carrier ID)
Value Table: SCARR
Table: SCARR
Carrier ID Name
AA American
DL Delta
LH Lufthansa
SA Singapore
UA United
Copyright © 2005 Accenture 12
Data Element
Attributes inherited from the domain
Copyright © 2005 Accenture 13
Interdependency of ABAP
Dictionary Objects
Tab.
Tab.
Tables Domains
"technical
field description"
From City
To City
S_FROM_CIT
S_TO_CITY
City
S_CITY
Tab.
Data elements
"semantic
field description"
Copyright © 2005 Accenture 14
Table
Primary key (Field) values
Table SCARR
Carrier ID
AA
DL
LH
UA
...
Carrier Name
American Airlines
Delta
Lufthansa
United Airlines
...
TABLE
Airline Carriers
Rows (tuples)
Copyright © 2005 Accenture 15
Relationships Between Tables:
Foreign Keys
PLANETYPE SEATSMAX
747-200 200 20000
A310-200 211 24000
757-300 301 17000
Check
Table
FLDATE CARRID PRICE CONNID
AA 1234 03/22/1999 500 747-200 125
UA 5678 01/06/1999 600 A310-200 90
Foreign
Key
Table
Table 1: Airplane Details Table SAPLANE
Table 2: Flight Table SFLIGHT
PLANETYPE SEATSOCC
CARGOMAX
Primary Key Foreign Key
Primary Key
Copyright © 2005 Accenture 16
Check Table - System Default
- DOMAIN S_PLANE
Value table
SAPLANE
System default
- Table SFLIGHT
- Field PLANETYPE
Check table SAPLANE
Copyright © 2005 Accenture 17
Cardinality
• Cardinality defines the type of
relationship between two tables.
• The cardinality of a foreign key
indicates how many dependent
records a record in a check
table may have. 1:1
1:C
1:N
1:CN
Cardinality Types
Copyright © 2005 Accenture 18
Configuration
Data
Master
Data
Transaction
Data
System
Data
• Sales Orders
• Purchase Orders
• Journal Entries
• Goods Receipts
• G/L Accounts
• Vendors
• Materials
• Stock Locations
• Metadata
• Programs
• Documentation
• System Settings
• Currency Codes
• Order Types
• Payment Terms
• Field Status Codes
SAP Data
Copyright © 2005 Accenture 19
SAP Table Types
Transparent
Cluster
Pool
Internal
ABAP
Dictionary
ABAP
Program
Copyright © 2005 Accenture 20
Table Definition
TRANSP table
Structure table
Create
transp. table
Activate
Note: DB table
will be created
automatically!
Create
int. table
Activate
Copyright © 2005 Accenture 21
Creating / Changing Tables
Copyright © 2005 Accenture 22
Technical Settings
Data class
Table category
Buffering
Log data changes
Master data
Transaction data
Organization & Customizing (System) data
Number of data records in DB storage area
single
generic (must specify number of key fields)
full
not buffered
Copyright © 2005 Accenture 23
Indexes
DB
S1 S2 ... F1 F2 ...
F2 S1 S2
T1_K T1
S1 S2 ... F1 F2 ... T1 T1_K
Identific.
Unique
Desc
ABAP Dictionary
Index
Copyright © 2005 Accenture 24
Data Class
TS1
TSn
TS2
.... TS1
TSn
TS2
.... TS1
TSn
TS2
....
TS1 ... TSn
APPL0
(Master)
TSYS1 ... TSYSn
APPL2
(Organization &
Customizing)
TB1 ... TBn
APPL1
(Transaction)
DB
Copyright © 2005 Accenture 25
TS1
Dict Table Selection
T1 0
T2 1
T3 2
T4 3
T5 4
DB
TS1 TS1 TS1
0
1
2
3
Number of data records
in a storage area
4
= 0 to 640K
= 610K to 2400K
= 2400K to 9800K
= 9800K to 39000K
= 39000K plus
Size Categories
Copyright © 2005 Accenture 26
Exercise 1 - Create Basic ABAP Dictionary Objects, 60 minutes
Exercise 2 - Create Table Indexes, 20 minutes
Exercises
Copyright © 2005 Accenture 27
Buffering
1st access
DB
T2
G1 G2 S3 F1 ...
T3
G1 G2 S3 ...
T1
S1 S2 F1 ...
ABAP Dictionary
S1 S2 F1 ... T1 T3
G1 G2 S3 ...
T2
G1 G2 S3 F1 ...
T1
S1 S2 F1 ...
TABL TABLP
Buffer: 100% and generic Buffer: partial
Yes Import record
No
Yes
No Yes
Generic
key
complete
SELECT
SINGLE
record exists
No 1st access
Yes
No
G1 G2 S3 F1 ... T2
S1 S2 F1 ... T3
Change number
of key fields
100% generic
partial
2
Copyright © 2005 Accenture 28
Logging
DB
Log T1
Field-related
log records
DD
S1 S2 F1 F2 F3 ... Table T1
System profile
Logging
Change
S1 S2 F2 F3 ...
Manual
Copyright © 2005 Accenture 29
INCLUDE Substructure
US USF1 USF2 USF3 .....
Table Field Data element
T1 S1 ...
TRANSP S2 ...
.INCLUDE US
F1 ...
... ...
T2 F1 ...
TRANSP .INCLUDE US
F2 ...
... ...
Copyright © 2005 Accenture 30
APPEND Substructure
Table Field Data Element
ZTBL1 FLD1 ...
TRANSP FLD2 ...
.APPEND ZAZTBL1
Database Field Sequence ABAP Dictionary Sequence
FLD1 FLDX FLD2 FLD1 FLD2 FLDX
Append contains
definition of field
FLDX
.APPEND CI_ZTBL1
OR
Customizing Include
Copyright © 2005 Accenture 31
Views
FIELD A FIELD B FIELD C FIELD A FIELD D FIELD E FIELD F
TABLE 1 TABLE 2
FIELD A FIELD C FIELD D FIELD F
VIEW 1
Copyright © 2005 Accenture 32
User selects row
Values are
returned
User chooses F4
on field
The search path used the
last time is displayed
User chooses a
different search
path
The chosen search
path is displayed
Hit list is displayed
A B C
A B C
Search Help
Copyright © 2005 Accenture 33
Search Help Fields
Copyright © 2005 Accenture 34
Exercise 3 – Create an Elementary Search Help, 30 minutes
Exercise
Copyright © 2005 Accenture 35
Data Browser
ABAP Workbench
Tools
Overview
Data Browser
(SE16)
Copyright © 2005 Accenture 36
User Parameters
Copyright © 2005 Accenture 37
Using the Browser
Copyright © 2005 Accenture 38
Settings
Sort Sequence for
output list ...
- List table fields
- Maximum 9 sort fields
- Flag fields with 1 to 9
Fields to be
selected ...
- List table fields
- Flag the fields to
be included in the
the output list
Affects the
output list
Fields to be
used for data
selection ...
- List table fields
- Flag the fields to
be used for data
selection
- Maximum 40
Affects the
selection screen
Personal Settings
- Width of output list
- Maximum number of
entries to be selected
- Take into account
conversion exit
- Column headings can
be either:
. Field name, or
. Field text
(from data element)
Data Browser: Table SPFLI
.... .... .... Settings .... .... System Help
List format Sort
User parameters Choose Fields
Fields For Selection
Copyright © 2005 Accenture 39
Exercise 4 - ABAP Dictionary Search, 30 minutes
Exercise 5 - View a Table with the Data Browser, 20 minutes
Exercises
Copyright © 2005 Accenture 40
Any questions?
Questions & Answers