3.ecl fi abap abapdictionary objects
DESCRIPTION
ABAPTRANSCRIPT
PricewaterhouseCoopers
ABAP Dictionary Objects
Tables
Views
Data Elements
Domains
Search Help
Lock Objects
Using a Table in an ABAP Program
PricewaterhouseCoopers
Basic Objects of the ABAP Data Dictionary
Table CTable BTable A
Data Element 1 Data Element 2
DomainDomain
PricewaterhouseCoopers
Tables
TABLE KNA1TABLE KNA1(Customers)(Customers)
Name 1 ORT 02MANDT KUNNRTable: KNA1Table: KNA1
PricewaterhouseCoopers
Create a Table
Enter a description (short text).
Maintain delivery class
Table Maintenance attributes
PricewaterhouseCoopers
Create a Table
Maintain field attributes
PricewaterhouseCoopers
Two-Level Domain Concept
Data Element 1 Data Element 2
DomainDomain
PricewaterhouseCoopers
Data Elements
Table BTable A
Data Element 1
PricewaterhouseCoopers
Pre-Defined Data Elements
PricewaterhouseCoopers
Data Element Documentation
PricewaterhouseCoopers
Create Data Element
Enter a description (short text).
Enter domain name.
PricewaterhouseCoopers
Create Data Element
Maintain field labels and column headers.
PricewaterhouseCoopers
Domains
Table ATable A
Data ElementsData Elements
DomainDomain
PricewaterhouseCoopers
Characteristics of Domains
Table ATable A
Data ElementsData Elements
DomainDomain
PricewaterhouseCoopers
Allowed Values
Value Table
DomainDomain DomainDomain
JanuaryFebruaryMarch . . . . . . .December
PricewaterhouseCoopers
validvalues
invalidvalues
Benefits of Using Allowed Values
PricewaterhouseCoopers
Create a Domain
Enter a description (short text).
Enter data type and length.
PricewaterhouseCoopers
Create a Domain
Explicit values or a valuetable may be entered.
PricewaterhouseCoopers
Using a Table in Program Code
TABLES:YEMPLOY.
SELECT *FROM YEMPLOY.
WRITE:/ YEMPLOY-IDYEMPLOY-NAMEYEMPLOY-SALARY
ENDSELECT.
PricewaterhouseCoopers
Foreign Key Relationships
Definition & Uses of Foreign Keys
Prerequisites for Constructing Foreign Key Relationships
Key Terminology
Cardinality and Foreign Key Field Types
Foreign Keys with Multiple Fields
PricewaterhouseCoopers
Definition of Foreign Keys
PricewaterhouseCoopers
Uses of Foreign Keys
Maintain data integrity
Provide help texts
Create aggregate dictionary objects
PricewaterhouseCoopers
Prerequisites for Constructing Foreign Key Relationships
The foreign key field and the primary key of the check table must share the same domain.
A value table must exist for that domain.
PricewaterhouseCoopers
Check TableCheck Table
Value TableValue Table
Foreign Keys: Key Terminology
Foreign Key TableForeign Key Table
PricewaterhouseCoopers
Let’s review some of the key terminology relating to foreign keys.Value table: The table containing the set of allowed values attached to a domain.Check table: The table that is referenced by a foreign key. A check table is either identical to a value table, or is another table containing a subset of the records in a value table.Foreign key table: The table containing fields that are the primary key of the other table. The foreign key table is also known own as the “dependent” or “child” table.
Slide 25 PricewaterhouseCoopers
EXAMPLE:
For example, suppose a telephone company stores general customer information in the CUSTOMERS table and stores specialised information about business customers in the BUSINESS_CUSTOMERS table.
Suppose that there was also a BUSINESS_OWNERS table that listed the owners of all business customers. The BUSINESS_OWNERS table might consist of two fields: Customer ID and the name of each individual owner.
In this case, we would establish a foreign key relationship between the BUSINESS_OWNERS table and the BUSINESS-CUSTOMERS table.
The value table for the customer ID field in the BUSINESS_OWNERS table would be the CUSTOMERS table, but the check table would be the BUSINESS_CUSTOMERS table.
The foreign key table would be the BUSINESS_OWNERS table.
PricewaterhouseCoopers
Creating a Foreign Key Relationship
Foreign key push-button
PricewaterhouseCoopers
Cardinality
n n : : m m1
C
1
C
N
CN
PricewaterhouseCoopers
When creating foreign key relationships, you should always specify the cardinality of that relationship. Here is a reminder of the possible values for each side of the n : m notation that SAP uses to specify cardinality. For a fuller review of cardinality, see Chapter 2.For the left side:n = 1 Each record in the foreign key table refers to exactly one record in the check table.n = C Each record in the foreign key table refers to zero or one records in the check table.For the right side:m = 1 Each record in the check table has exactly one
dependent record. m = C Each record in the check table has a zero or one
dependent records. m = N Each record in the check table has at least one
dependent record. m = CNEach record in the check table has zero, one, or many dependent entities.
PricewaterhouseCoopers
Maintaining a Foreign Key Relationship’s Attributes
Check table(defaults tovalue table)
Enter a description (short text).
Maintain cardinality n : m
Maintain foreignkey type
Slide 30 PricewaterhouseCoopers
Foreign Key Field Type:
The foreign key field type indicates whether the foreign key fields belong to the primary key (or a candidate key) of the foreign key table.
A candidate key is a field or combination of fields that uniquely identifies a record, but it is not necessarily the primary key of that table. (In some tables, there are multiple candidates for the primary key, but only one combination can be selected to be the primary key.)
Key Fields of a Text Table are a special instance of Key Fields or Key Field Candidates. An additional condition in this case is that the dependent table is a language-dependent text table for the referenced table. The key of the text table is composed of the key of the referenced table and a language key.
For example, the table T005T contains language-dependent descriptions of country codes. The key fields of this table are client (MANDT), language key (SPRAS), and country key (LAND1). The foreign key type of the foreign key on the field LAND1 is Key Fields of a Text Table. This is because LAND1 and SPRAS (the language key) are both part of the primary key of T005T.
Foreign key fields that do not belong to the identifying fields of the foreign key table are of the type: Non-key Field Candidates.
PricewaterhouseCoopers
ABAP Dictionary Tablesin Relational Databases
SAP Table Types
Technical Settings
Indexes
PricewaterhouseCoopers
SAP Table Types
Transparent Table (TRANSP) Structure (INTTAB)
Pool Table Cluster Table
View
PricewaterhouseCoopers
Transparent TablesType = TRANSP
Master DataMaster Data
PricewaterhouseCoopers
Table Types TRANSPin the Database
DB
PROFILE
PricewaterhouseCoopers
Pool Tables: Overview
Slide 36 PricewaterhouseCoopers
Cluster Tables : Overview
PricewaterhouseCoopers
Technical Settings
Master Transaction
Organization & Customizing
User
Data class
Number of data records in DB storage
Single records, generic, full, not buffered
on or off
Size category
Buffering
Log data changes
PricewaterhouseCoopers
Master data User data
Data Class
Organization and Customizing dataTransaction data
DB
PricewaterhouseCoopers
Size Categories
PricewaterhouseCoopers
Buffering Type
None
Single Record Generic
Full
KF1 KF2 KF3 F4 F5 F6 KF1 KF2 KF3 F4 F5 F6
KF1 KF2 KF3 F4 F5 F6
PricewaterhouseCoopers
Maintaining Technical Settings
Slide 42 PricewaterhouseCoopers
Table Logging
Transaction code : SCU3
PricewaterhouseCoopers
Table Index: Primary Index
Slide 44 PricewaterhouseCoopers
Table Index: Secondary Index
PricewaterhouseCoopers
ABAABAP P DictiDictionaronar
yy
DB
Database Utility
PricewaterhouseCoopers
ABAP Dictionary Objects: Views
Definition
Relational operations
Types of views
Using a view in program code
PricewaterhouseCoopers
What is a View?
PricewaterhouseCoopers
The Most Basic Form of a View
PricewaterhouseCoopers
The Relational Operations
Table 2Selection
View BView B
Table 1Projection
View View AA
View CView C
JoinTable 4Table 4Table 3Table 3
PricewaterhouseCoopers
The Projection Operation
Projection
View AView A
Table 1
Slide 51 PricewaterhouseCoopers
Specifying Projected Fields
Can use any name if database view, Can use any name if database view, otherwise must be same name as table field.otherwise must be same name as table field.
Indicate actual table Indicate actual table Fields and data elements.Fields and data elements.
PricewaterhouseCoopers
The Selection Operation
Selection
View BView B
Table 2
Example:Staff Level <= 3
PricewaterhouseCoopers
Specifying Selection Criteria
1 3 52 4
Can include unprojected fields
PricewaterhouseCoopers
The Join Operation
Table Table 33
Join
Table Table 44
View CView C
PricewaterhouseCoopers
Inner Join & Outer Join
PricewaterhouseCoopers
ID Salary Date Effective
5579 $10,000.00 10/1/91
5579 $11,000.00 10/1/92
5579 $12,000.00 10/1/94
5579 $13,000.00 10/1/96
Understanding the Join Operation
ID Name …
EmployeeEmployee
SalarySalary
Right
PricewaterhouseCoopers
The Join Operation and Foreign Keys
View CView C
Join
Table 4Table 4Table 3Table 3Primary Secondary
Slide 58 PricewaterhouseCoopers
Specifying Joined Fields
Hit button to see related tables and Hit button to see related tables and automatically generate join conditions.automatically generate join conditions.
Indicate base tables that data will come from.Indicate base tables that data will come from.
PricewaterhouseCoopers
Types of Views in the ABAPDictionary
Database View
Projection View
Help View
Maintenance View
PricewaterhouseCoopers
The Database View
PricewaterhouseCoopers
The Projection View
PricewaterhouseCoopers
Help View
PricewaterhouseCoopers
Maintenance ViewTransaction : SM30, SE54
PricewaterhouseCoopers
Using a View in Program Code
TABLES: YXXEMP_V.
SELECT *FROM YXXEMP_V.
WRITE: / YXXEMP_V-EMP_IDYXXEMP_V-LAST_NAME,YXXEMP_V-FIRST_NAME.
ENDSELECT.
Slide 65 PricewaterhouseCoopers
Overview of Search Helps
Benefits of Search Helps
Elementary Search Helps
Collective Search Helps
Search Help Exits
Slide 66 PricewaterhouseCoopers
The Benefits of Search Helps
What was Smith’sWhat was Smith’s vendor number, vendor number,
anyway?anyway?
F4F4
Slide 67 PricewaterhouseCoopers
Elementary vs. Collective
CollectiveCollectiveSearch HelpSearch Help
EElleemmeennttaarryy
11
Field H
Field B
Field K
EElleemmeennttaarryy
22
Field Z
Field O
EElleemmeennttaarryy
33
Field A
EElleemmeennttaarryy
44
Field RField XField BField OField Q
Slide 68 PricewaterhouseCoopers
Creating an Elementary Search Help
Create search help from Dictionary pushbutton on Create search help from Dictionary pushbutton on workbench, or from within Repository Browser.workbench, or from within Repository Browser.
Slide 69 PricewaterhouseCoopers
Defining an Elementary Search Help
OptiOptional onal exitexit
Hit List Hit List Display Display MethodMethod
Used to Used to identify identify
search helpsearch help
Data source Data source for hit listfor hit list
Interface Interface ParameteParamete
rsrs
Slide 70 PricewaterhouseCoopers
Defining an Elementary Search Help - Interface Parameters
Parameters for values you Parameters for values you want to send and receivewant to send and receive
Declaration of parameters Declaration of parameters as import and/or exportas import and/or export
Parameter is display onlyParameter is display only
Data element associatedData element associatedwith parameterwith parameter
Position parameterPosition parameterwill be on hit listwill be on hit list Position parameter will Position parameter will
be on dialog boxbe on dialog box
Optional defaultOptional defaultfor parameterfor parameter
Slide 71 PricewaterhouseCoopers
Assigning an Elementary Search Help - Priority Levels
TableTable
Data ElementData Element
FieldField
Slide 72 PricewaterhouseCoopers
Using Elementary Search Helps
F4F4
Slide 73 PricewaterhouseCoopers
Defining a Collective Search Help - Interface
Notice there is no selection method. Notice there is no selection method. AA
collective search help is a set of one collective search help is a set of one oror
more elementary search helps.more elementary search helps.
Slide 74 PricewaterhouseCoopers
Defining a Collective Search Help -Adding Elementary Search Helps
Don’t forget to assign parameters Don’t forget to assign parameters for each elementary search help.for each elementary search help.
Slide 75 PricewaterhouseCoopers
Using a Collective Search Help
F4F4
Only difference from Only difference from Before - toggle tab Before - toggle tab
between elementary between elementary Search helps.Search helps.
Slide 76 PricewaterhouseCoopers
Lock Object
Naming Convention : Starts with “E”
Lock Object will generate 2 function modules:
ENQUEUE_<LOBJ.NAME>
DEQUEUE_<LOBJ.NAME>
Setting & Releasing Lock:
Setting the lock :Call function ENQUEUE_<LOBJ.NAME>UPDATE < LOBJ.NAME>
Releasing the lock:Call function DEQUEUE_<LOBJ.NAME>
Slide 78 PricewaterhouseCoopers
Lock Object Details
Slide 79 PricewaterhouseCoopers
Lock Objects Parameters