Sei sulla pagina 1di 172

Overview of the ABAP Dictionary Srinivasulu Nettem

Overview of the ABAP Dictionary


Definition and functions of the ABAP Dictionary Basic objects of the ABAP Dictionary The Database Utility

July 13, 2013

What is a Data Dictionary?

Data Dictionary

July 13, 2013

Functions of the ABAP Dictionary

Data Integrity

No Redundant Data Definitions

Data Dictionary

Integration with the ABAP Workbench


July 13, 2013

Data Integrity

July 13, 2013

No Redundant Data Definitions

July 13, 2013

Integration with the ABAP Workbench

Data Dictionary

July 13, 2013

Basic Objects of the ABAP Dictionary

Table A

Table B

Table C

Data Element 1

Data Element 2

Domain
July 13, 2013

Database Utility

Database
Data Dictionary

Database Utility

July 13, 2013

Data Modeling
What is data modeling? Entities, attributes, & entity types Data modeling vs. ABAP Dictionary terminology Relationships and relationship types Cardinality Optionality Category Data model hierarchies Linking a data model to dictionary objects

July 13, 2013

What is Data Modeling?

Real World

Data Dictionary

Data Model

Data Dictionary
July 13, 2013

Uses of a Data Model

July 13, 2013

Basic Components of a Data Model

Customer

Entity

Attribute 30 S. 17th St. Order Entity Type

July 13, 2013

Entity

Customer

Product

Order

July 13, 2013

Attribute

Customer

30 S. 17th St.

J. Elkins

215-555-8000

July 13, 2013

Entity Type
Customer

Product

Order

July 13, 2013

Data Modeler/ ABAP Dictionary Terminology


Customer: Customer address: Customers: Data Modeler entity attribute entity type ABAP Dictionary record field table

July 13, 2013

Relationships between Entities

Customer

Order

July 13, 2013

Cardinality

One - to - Many

Many - to - Many

One - to - One
July 13, 2013

Many-to-Many Relationships
Order Lines Order # Qty Part 1 1 # A26 1 3 C589 2 1 A26 Primary Keys: Order Number Product Number

Order

Primary Key: Order Number

Primary Key: Product Number July 13, 2013

Optionality

Customer

Order

Customer

July 13, 2013

Referenced and Dependent Entity Types

Referenced Entity Type Dependent Entity Type

Customer
Customer ID Name Address ... ...

Referenced Dependent
July 13, 2013

Order
Order ID Date of Order Customer ID

SAP Graphic Notation

July 13, 2013

Example Using Graphic Notation

Customers

Orders

July 13, 2013

Practice Using Graphic Notation I

Professors

Students

July 13, 2013

Practice Using Graphic Notation II

Professors

Students

July 13, 2013

Practice Using Graphic Notation III

Students

Enrolment Records

Courses

July 13, 2013

SAP Graphic Notation with Text Notation

1 C

CN
July 13, 2013

SAP Text Notation

n : m
1 C 1 C N CN
July 13, 2013

Example Using Text Notation

Customers

Orders

CN
July 13, 2013

Practice Using Text Notation I

Professors

Students

:
July 13, 2013

Practice Using Text Notation II

Professors

Students

:
July 13, 2013

Practice Using Text Notation III

Students

Enrolment Records

Courses

:
July 13, 2013

Category

Hierarchical

Conditional-Referential

Referential

Aggregating

Specialisation
July 13, 2013

Relationship Category: Hierarchical

Department
Key: Department Number

Course
Key: Department Number Course Number

July 13, 2013

Relationship Category: Aggregating

Student
Key: Student ID Number

Enrollment Record
Key: Student ID Number Course Number

Course
Key: Course Number

July 13, 2013

Relationship Category: Referential

Professor
Key: Professor Number

Department
Key: Department Number

July 13, 2013

Relationship Category: Conditional-Referential

Professor
Key: Professor Number

Department
Key: Department Number

July 13, 2013

Relationship Category: Specialisation

Customer
Key: ID Number

Business Customer
Key: ID Number

July 13, 2013

Data Model Hierarchies and the SAP EDM

FI

General Accounting . . . Currency . . .

. . .

Chart of Accounts

July 13, 2013

Linking a Data Model to ABAP Dictionary Objects

Data Dictionary

Data Model

July 13, 2013

ABAP Dictionary Objects


Tables Data Elements Domains Using a Table in an ABAP Program

July 13, 2013

Accessing the ABAP Dictionary

Data Dictionary

July 13, 2013

Basic Objects of the ABAP Data Dictionary


Table A Table B Table C

Data Element 1

Data Element 2

Domain
July 13, 2013

Tables

TABLE KNA1 (Customers)

Table: Table: KNA1 KNA1 MANDT KUNNR Name 1 ORT 02

July 13, 2013

Create a Table
Maintain delivery class Enter a description (short text).

Maintain field attributes in Fields tab

Table maintenance attribute

July 13, 2013

Two-Level Domain Concept

Data Element 1

Data Element 2

Domain

July 13, 2013

Data Elements
Table A Table B

Data Element 1

July 13, 2013

Pre-Defined Data Elements

July 13, 2013

Data Element Documentation

July 13, 2013

Create Data Element


Enter a description (short text).Enter domain name.

aintain field labels and column headers in the Field Label tab
July 13, 2013

Domains

Table A

Data Elements

Domain

July 13, 2013

Characteristics of Domains

Table A

Data Elements

Domain

July 13, 2013

Allowed Values

Domain

Domain

January February March . . . . . . . December


July 13, 2013

Value Table

Benefits of Using Allowed Values

valid values

invalid values

July 13, 2013

Create a Domain

Enter a description (short text).

Enter data type and length.

Explicit Values, Intervals or a value table may be entered In the Value range tab

July 13, 2013

Using a Table in Program Code

TABLES:YEMPLOY. SELECT * FROM YEMPLOY. WRITE:/ YEMPLOY_ID YEMPLOY_NAME YEMPLOY_SALARY ENDSELECT.

July 13, 2013

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

July 13, 2013

Definition of Foreign Keys

July 13, 2013

Uses of Foreign Keys


Maintain data integrity Provide help texts Create aggregate dictionary objects

July 13, 2013

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.

July 13, 2013

Foreign Keys: Key Terminology

Value Table

Check Table

Foreign Key Table


July 13, 2013

Foreign Key Terminology: Check Table = Value Table

Check Table

Valu e Tabl e

July 13, 2013

Foreign Key Terminology: Check Table Value Table

Check Table

Valu e Tabl e

July 13, 2013

Establishing a Foreign Key Relationship in the ABAP Dictionary

Data Dictionary

July 13, 2013

Cardinality

n : m
1 C 1 C N CN
July 13, 2013

Foreign Key Field Type


Check Table: Students Foreign Key Table: Course Enrolment

Course Enrolment

STUDENT_ID

July 13, 2013

Foreign Key Type: Key Fields or Key Field Candidates

Faculty

Course

July 13, 2013

Foreign Key Type: Key Fields of a Text Table

T005 (Country Codes) T005T (Country descriptions) (T002) (Language Codes)

July 13, 2013

Foreign Key Type: Non-Key Field Candidates

Professor

Course

July 13, 2013

Creating a Foreign Key Relationship

Foreign key push-button

July 13, 2013

Maintaining a Foreign Key Relationships Attributes

Enter a description (short text). Check table (defaults to value table)

Maintain foreign key type

Maintain cardinality n : m

July 13, 2013

Foreign Keys with Multiple Fields

July 13, 2013

Field-By-Field Assignment

Foreign Key Table

Check Table

July 13, 2013

Partial Foreign Keys

July 13, 2013

Constant Foreign Keys

O I B

July 13, 2013

Changing the Field Assignment

Generic foreign key Constant foreign key

July 13, 2013

ABAP Dictionary Tables in Relational Databases


SAP Table Types Technical Settings Indexes

July 13, 2013

SAP Table Types

Transparent Table (TRANSP) Pool Table

Structure (INTTAB)

Cluster Table

View
July 13, 2013

Transparent Tables Type = TRANSP

Master Data

July 13, 2013

Table Types TRANSP in the Database

PROFILE

DB

July 13, 2013

Mapping a Table of Type INTTAB

PROFILE

DB

x
July 13, 2013

Pool and Cluster Tables: Overview

Pool Table

Cluster Table

July 13, 2013

Technical Settings

Data class

Size category

Master Transaction Organization & Customizing User Number of data records in DB storage Single records, generic, full, not buffered on or off
July 13, 2013

Buffering

Log data changes

Data Class

Transaction data

Organization and Customizing data

Master data

User data

DB
July 13, 2013

Size Categories

July 13, 2013

Buffering Type

Single Record
KF1 KF2 KF3 F4 F5 F6 KF1 KF2

Generic
KF3 F4 F5 F6

Full
KF1 KF2 KF3 F4 F5 F6

None
July 13, 2013

Logging

July 13, 2013

Maintaining Technical Settings

July 13, 2013

Index

July 13, 2013

Database Utility

AB Dict AP iona r y

DB
July 13, 2013

Adding Structures
Substructures Customizing Includes Append Structures

July 13, 2013

Including Structures in Tables

Customer Tables Substructures Table YCUSTAB .INCLUDE YSTRUC

SAP Tables Customizing Includes Table XYZ .INCLUDE CI_XXX

Append Structures Field 1 Field 2 ... Field n Table T .APPEND ZAT

SAP Tables
July 13, 2013

Substructure

YS Table

YS-F1 YS-F2 YS-F3...

Field Data element YT1 S1 (TRANSP) S2 .INCLUDE YS F1

Table

Field Data element YT2 S1 (TRANSP) S2 .INCLUDE YS F1


July 13, 2013

Customizing Include

CI_XXX-F2 CI_XXXCI_XXX CI_XXX-F1 F3 Table Table Field Field XYZ XYZ Data Data element element S1 S1 F1 F1 . .. .. . Fn Fn CI_XXX

.INCLUDE

July 13, 2013

Append Structure

ZAT

ZAT-F1 ZAT-F2 ZAT-F3

Table

Field T

Data element S1 F1 ... Fn ZAT

.APPEND

July 13, 2013

ABAP Repository Information System

The Repository Information System Object Searches (Find) Use of Objects in Objects (Where-Used) Searching for Objects Outside the Dictionary

July 13, 2013

ABAP Repository Info System: Typical Queries

ABAP Dictionary

Find (Object Search) Find all objects of type A with attributes X, Y, Z.

Where-used lists Find all objects of type A that use object B


July 13, 2013

ABAP Repository: Initial Screen

July 13, 2013

Find: Selection Screen

Enter a single value for the search attributes or use the arrow push-buttons for selection options Use the All Selections pushbutton to limit search criteria on other object attributes
July 13, 2013

Selection Options
Simplified Selection (single values)

Equal Pattern

Not equal Exclude pattern Greater than Less than

>Greater than or equal > < Less than or equal <

Toggle push-buttons Complex Selection (ranges)

[]

Inclusive

][

Exclusive
July 13, 2013

Hit List Options: Standard Options

July 13, 2013

Hit List Options: Application Toolbar

July 13, 2013

Where-Used List: Selection Screen

List of all objects that object may be used in

July 13, 2013

Relationship between Objects Where-Used and Sub-Objects Lists

Program
Table Data Elements Domains

Screen
July 13, 2013

ABAP Repository Info System

Modeling

ABAP Dictionary

Programming

Environment

July 13, 2013

ABAP Dictionary Changes


Activation Data Consistency and Conversion Version Management Miscellaneous Changes

July 13, 2013

Activation

Data Object

ABAP Dictionary Activation Icon

July 13, 2013

Mass Activation

Online

Background

July 13, 2013

Table Activation

Screen Painter

ABAP Programs

? Consistency

? Checks

Log Entries

Updates

July 13, 2013

Database Utility

ABA Dict P iona r y

Online vs. Background

Log File DB
July 13, 2013

Change Key of Value Table


Tables YANGIE1 YEMPLOY YZIPCODES Value Table
1 1 9 9 7 7 0 0 2 2

Domain YZIP
NUMC 10
July 13, 2013

Versions

July 13, 2013

Version Management

modified (revised) version

active version

temporary versions
July 13, 2013

Version Management

Display

Compare

Retrieve stored version of object

REMOTE compare

July 13, 2013

Locks on Dictionary Objects

ABA Dict P iona r y

July 13, 2013

SPDD Transaction

July 13, 2013

ABAP Dictionary Objects: Views


Definition Relational operations Types of views Using a view in program code

July 13, 2013

What is a View?

July 13, 2013

The Most Basic Form of a View

July 13, 2013

The Relational Operations

Projection Table 1

Selection Table 2

Join Table 3 Table 4

View A

View C View B

July 13, 2013

The Projection Operation

Projection Table 1

View A

July 13, 2013

Specifying Projected Fields

Indicate actual name of table field that holds that data.

Can use any name if database view, otherwise must be same name as table field
July 13, 2013

The Selection Operation

Selection Table 2

Example: Staff Level <= 3 View B

July 13, 2013

Specifying Selection Criteria

Can include unprojected fields

5
July 13, 2013

The Join Operation

Join Table 3 Table 4

View C

July 13, 2013

The Necessity of the Join Operation


Employee ID Salary ID 5579 5579 5579 5579 Name Smith Smith Smith Smith Salary $10,000.00 $11,000.00 Wrong $12,000.00 $13,000.00
July 13, 2013

Name Salary 1 Salary 2 Salary 3

Understanding the Join Operation

Employee ID Salary ID 5579 5579 5579 5579 Salary Date Effective 10/1/91 10/1/92 10/1/94 10/1/96
July 13, 2013

Name

$10,000.00 $11,000.00 $12,000.00 $13,000.00

Right

The Join Operation and Foreign Keys


Primary
Table 3

Join

Secondary
Table 4

View C

July 13, 2013

Specifying Joined Fields

Indicate base tables that data will come from.

Hit button to see related tables and automatically generate join conditions.
July 13, 2013

Types of Views in the ABAP Dictionary


Database View Projection View Help View Maintenance View

July 13, 2013

The Database View

Database View

DB

Database

July 13, 2013

The Projection View

Projection View

View C

July 13, 2013

Database vs. Projection Views

Projection View

Database View

July 13, 2013

Other Types of Views


Help View Maintenance View

July 13, 2013

Using a View in Program Code

TABLES:

YXXEMP_V.

SELECT * FROM YXXEMP_V. WRITE: / YXXEMP_V-EMP_ID YXXEMP_V-LAST_NAME, YXXEMP_V-FIRST_NAME. ENDSELECT.

July 13, 2013

Overview of Search Helps


Benefits of Search Helps Elementary Search Helps Collective Search Helps Search Help Exits

July 13, 2013

The Benefits of Search Helps

What was Smiths vendor number, anyway?

F4

July 13, 2013

Elementary vs. Collective

Collective Search Help

E l e m e n t a r y 1

Field H Field B Field K

E l e m e n t a r y 2

Field Z

Field O

E l e m e n t a r y 3

Field A

E l e m e n t a r y 4

Field R Field X Field B Field O Field Q

July 13, 2013

Creating an Elementary Search Help

1 5 2 3 4

Create search help from Dictionary pushbutton on workbench, or from within Repository Browser.
July 13, 2013

Defining an Elementary Search Help

Interface Parameters

July 13, 2013

Defining an Elementary Search Help - Interface Parameters


Parameter is display only Data element associated with parameter

rameters for values you ant to send and receive

Declaration of parameters as import and/or export

Position parameterPosition parameter will will be on hit list be on dialog box

Optional default for parameter


July 13, 2013

Assigning an Elementary Search Help - Priority Levels

July 13, 2013

Using Elementary Search Helps

F4

July 13, 2013

Defining a Collective Search Help - Interface

Notice there is no selection method. A collective search help is a set of one or more elementary search helps.

July 13, 2013

Defining a Collective Search Help Adding Elementary Search Helps

Dont forget to assign parameters for each elementary search help.

July 13, 2013

Using a Collective Search Help

F4

July 13, 2013

Search Help Exits

Function Module with ABAP code _________ ______ _______ ______ _____ _____

Search Help Processing

July 13, 2013

Online Help & Documentation


Documentation for Dictionary objects F1 help F4 help Data element documentation/ supplemental documentation

July 13, 2013

Online Help & Documentation

F4: Possible Input Values

F1: Field Help DE doc. DE supp. doc.

Other documentati on: Tables Structures Domains

July 13, 2013

Data Element Documentation

Data Docu Element men tatio n

July 13, 2013

Table THLPF

Progra m

Scree n

Table/fie ld

No entry necessar y

DE Supplement number

July 13, 2013

Create Documentation through F1 or Screen Painter

From Plain F1 From DE Doc. From DE Doc. or from DE Supp. Doc. if DE Supp. Doc. is maintained

July 13, 2013

Type Groups

ABAP Editor ABAP Editor PROGRAM 123. TYPE-POOL . . . PROGRAM ABC. TYPE-POOL . . . ABAP Editor PROGRAM XYZ. TYPE-POOL . . .

Data Docu Element m en tatio n

TYPE GROUP

ABAP Dictionary
July 13, 2013

Type Group - Use in Programs


ABAP Dictionary ABAP Editor

ABAP Program Run-Time Selection Screen

July 13, 2013

Review of The ABAP Dictionary

Basic Objects of the ABAP Dictionary

Table A

Table B

Table C

Data Element 1

Data Element 2

Domain
July 13, 2013

Two-Level Domain Concept

Data Element 1

Data Element 2

Domain

July 13, 2013

Domains

Table A

Data Elements

Domain

July 13, 2013

Data Elements

Table A

Table B

Data Element 1

July 13, 2013

Tables

TABLE KNA1 (Customers)

Table: KNA1 MANDT KUNNR Name 1 ORT 02

July 13, 2013

Relationships Between Tables

Customer Table

Order

July 13, 2013

Cardinality

One - to - Many

One - to - One Many - to - Many


July 13, 2013

Many-to-Many Relationships

Order

Qty 1 3 1

Part # A26 C589 A27

Order Lines

July 13, 2013

Optionality

Customer

Order

Customer

July 13, 2013

Category

? Hierarchical Conditional-Referential

Referential

Aggregating

Specialisation
July 13, 2013

Referenced and Dependent Tables

Referenced Table Dependent Table

Customer Customer ID Name

Address

. . . Referenced

Order der ID Date of Order

Customer ID Dependent ...


July 13, 2013

Data Model Hierarchies and the SAP EDM

FI

General Accounting . . . Currency . . .

. . .

Chart of Accounts

July 13, 2013

SAP Graphic Notation

July 13, 2013

SAP Text Notation

n : m
1 C 1 C N CN
July 13, 2013

Uses of a Data Model

July 13, 2013

July 13, 2013