4-data dictionary.doc

31
7/23/2019 4-Data Dictionary.doc http://slidepdf.com/reader/full/4-data-dictionarydoc 1/31 Data Dictionary SAPData Dictionary and using Data Dictionary Objects, Tables, Views, Domains, Data elements and lock objects Data Dictionary and What are main Functions of Data Dictionary in SAP? SAPData Dictionary is acentral repository for the development of Objects, SAPData Dictionary is used to create and maintainmeta data ( data definitions ) . T-Code for Data Dictionary is SE11 . SQL Canbedivided intotwo parts DML -- Data ManipulationLanguage DDL -- Data DefinitionLanguage Where DML consists of SELECT, INSERT, UPDATE, MODIFY, DELETEetc, this will be handled by ABAPPrograms and DDL consists of commands like CREATETABLE,DROPTABLE,ALTER TABLE, CREATEINDEXetc, this will behandledby Data Dictionary, hence Data Dictionary is thecentral repository for thedevelopment of objects . The MainFunctionsof Data Dictionaryare : Data Base Tables Views Data Elements Domains Structures SearchHelps Lock Objects An ABAPConsultant may need to work onbelowareas of data dictionary : Creating Tables CreatingData elements andDomains

Upload: kiran

Post on 18-Feb-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 1/31

Data Dictionary

SAP Data Dictionary and using Data Dictionary Objects,Tables, Views, Domains, Data elements and lock objects

Data Dictionary and What are

main Functions of Data

Dictionary in SAP ?SAP Data Dictionary is a central repository for the development of Objects, SAP Data Dictionary

is used to create and maintain meta data ( data definitions ) . T-Code for Data Dictionary isSE11.

SQL Can be divided into two parts

• DML -- Data Manipulation Language

• DDL -- Data Definition Language

Where DML consists of SELECT, INSERT, UPDATE, MODIFY, DELETE etc, this will be handled

by ABAP Programs and DDL consists of commands like CREATE TABLE, DROP TABLE, ALTER

TABLE, CREATE INDEX etc, this will be handled by Data Dictionary, hence Data Dictionary is

the central repository for the development of objects .

The Main Functions of Data Dictionary are :

• Data Base Tables

• Views

• Data Elements

• Domains

• Structures

• Search Helps

• Lock Objects

An ABAP Consultant may need to work on below areas of data dictionary :

• Creating Tables

• Creating Data elements and Domains

Page 2: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 2/31

• Creating structures and Table types

• Creating search helps

• Creating Lock objects

• Creating data base views

Navigation: T-code : SE11

Data Types-Domains-Data

ElementsABAP uses different types of Data Types for Objects, basically there are three types of data types

Elementary Data types, Complex Types, Reference Types .

In Elementary types there are again two types of data types( Categories ) Fixed Length and

Variable Length .

Fixed Length:

• C Text Field

• N Numeric

• D Date

• T Time

• H Hexadecimal

• P Parked Number

• I Integer

• F Float

Variable Length• STRING Character Sequence

• XSTRING Byte Sequence

Complex Types includes Structure Types and Table Types.

Reference Types includes Data References and Object References

What is a Date Element in SAP ABAP ?

Data element is an object which specified semantic information of a field, ex: field label , heading.

(We all know that table is a collection of fields, ex: STUDENT is a table with fields STUDENT_ID,

Page 3: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 3/31

STUDENT_NAME ext, data element specifies the field labels and headings for these fields )

What is a Domain in SAP ABAP ?

Domain is an object which specified technical information of a field in a table ex: Data type,

length, value range etc

Why we use Data elements and Domains in SAP ?

When ever we are creating a new table or adding a field to existing table, we need to specify field

labels and data types for the field, in SAP we maintain these values in the form of Data elements

and Domains.

Creating Domain and Data

ElementCreating a Domain in SAP

Go to SE11 T-code, select domain radio button, provide a name (ZSAPN_DOMAIN) and create.

Provide short description, no of characters and save (Ctrl S ).

Page 4: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 4/31

Select local object ( non transportable object ).

Activate.

Domain is created.

Page 5: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 5/31

Creating data element in SAP

Go to SE11, select data type radio button, provide a name (ZSAPN_DATAELEMENT) and create.

A popup will open, select data element radio button

Enter short description and domain name (ZSAPN_DOMAIN) and select field label tab.

Page 6: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 6/31

Select field label tab and maintain field labels.

Save and Activate, Data element is created.

Page 7: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 7/31

Components of SAP TablesWhat are the components of database tables in SAP ? What is a key field,

delivery class and size category in SAP ?

Before creating a table we must know components of Table.

What is a key field ?

A field which dosent accept duplicate data is called as key field.

What is a delivery class ?

It specifies the type of data stored in a data base table ex: master data, Transaction data, system

data etc

Options available under delivery class :

A- Application Table (Master and Transaction data ).

C-Customizing table, maintenance only by customer not SAP.

L-Table for storing temporary data.

G, E, S, W - These are used to store system data (Basis data ).

Display and Maintenance

It specifies whether the user can display the data and maintain the data , the following options

are available under display and maintenance.

1.Display/Maintenance Allowed.- User can display and maintain data.

2.Display/Maintenance allowed with restrictions - Some users can display and maintain

data.

3.Display/Maintenance not allowed - No user can display data.

What is data class ?

It specifies the physical area of a table in the database, the following options are available under

data class.

APPL0 - Master data

APPl1 - Transaction data

APPL2 - Organization and Customizing

DDIM, DFACT, DODS etc are used by BI and BW.

Page 8: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 8/31

What is size category ?

It specifies the number of records that can be stored in a database table, options available under

size category are below.

Size Category No of expected records

0 0 - 7,100

1 7,100 - 28,000

2 28,000 - 1,10,000

The above numbers may vary from company to company .

Size category will be incremented dynamically based on increase in records.

Buffer

It is a temporary memory for storing the data .

It is same as cache memory.

The functionality of buffer is defined below.

Page 9: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 9/31

Types of database tables in SAPWhat are the different types of database tables in SAP ? What are

Transparent Tables, Pooled Tables and Cluster Tables in SAP ?

There are three types of tables available in SAP, explained below

Transparent table

There is a physical table on the database for each transparent table. The names of the physical

tables and the logical table definition in the ABAP/4 Dictionary correspond.

All business data and application data are stored in transparent tables.

Pooled table

Pooled tables can be used to store control data (e.g. screen sequences, program parameters or

temporary data). Several pooled tables can be combined to form a table pool. The table pool

corresponds to a physical table on the database in which all the records of the allocated pooled

tables are stored.

Cluster table

Cluster tables contain continuous text, for example, documentation. Several cluster tables can be

combined to form a table cluster. Several logical lines of different tables are combined to form a

physical record in this table type. This permits object-by-object storage or object-by-object

access. In order to combine tables in clusters, at least parts of the keys must agree. Several

cluster tables are stored in one corresponding table on the database.

Page 10: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 10/31

Creating Table in SAPHow to create a Transparent Table in SAP data dictionary ? What in Top to

Bottom and Bottom to top approach to create database tables in SAP ?

A table can be created in two ways one is top to bottom approach and another one is bottom to

top approach.

1.Top to Bottom : In this approach, first table fields are defined and later domain and data

element are defined.

2.Bottom to Top : In this approach, first domain and data element are defined and later table will

be created .

In this example we are going to learn creating a SAP transparent table using top to bottom

approach ( I suggest simplest way ).

Go to SE11 T-code, provide table name to be created ZSTUDENT_TABLE and create.

Provide short description, delivery class (A), Display Maintenance Allowed and select fields tab.

Page 11: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 11/31

Select Fields tab, add a field STUDENT_NO, data element as ZSTUDENT_NO and check Key

and Initial Value check boxes.

A table must contain at least one key field, without a key field we can not create a table.

Double click on data element ZSTUDENT_NO (Not yet created), a pop up will open click yes and

one more information message will come press enter.

Now a pop up will come asking to create date element, click yes.

Provide short description, domain and label

Page 12: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 12/31

Save, double click on domain name ZSTUDENT_NO, click on yes.

Provide short description, data type, no. characters, save and activate.

Page 13: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 13/31

Similarly create remaining fields with data elements and domains as below

Once all fields are created click on technical settings button.

Page 14: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 14/31

Provide data class and size category, save and activate.

You will get a warning message just click on No, table is created.

Now add entries to table.

Page 15: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 15/31

Page 16: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 16/31

Creating Structure in SAPWhat is a structure in SAP Data Dictionary ? How to create a Structure in SAP

data dictionary ?

Structure

Structure is list of fields defined under a name, which is used to process data at run-time in SAP

ABAP applications.

Structures are two types one is global structure and another one is local structure. Local structure

can be created in ABAP programs and global structure can be created in data dictionary and can

be reusable in different objects.

In this lesson we will be learning creating a structure in data dictionary.

Go to SE11, select Data Type radio button and click on create.

A pop up will open, select structure radio button and continue.

Page 17: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 17/31

Provide short description, add some fields, save and activate.

The structure is created, now we can use this structure in our ABAP programs.

Page 18: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 18/31

Difference between structure and

table in SAP data dictionaryTable and structure have lot of differences in the sense of behaviour and properties, the below

are the main differences between table and structure in data dictionary.

Table and Structure Difference

Table Structure

Table can store data physically and permanently. Structure can not store data physically,it can hold data at run time only.

Table have primary key. Structure dosent have any primary key.

Table have technical settings (data class, size category

etc), maintanance attributes ( Display maintanance

restrictions ).

Structure dosent have any technical

attributes and maintatance attributes.

Table have primary and secondary indexes. Structures dosent have primary and

secondary indexes.

Page 19: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 19/31

Difference between Transparent,

pooled and cluster tables inSAP

The below are the major differences between transparent, pooled and cluster tables in SAP data

dictionary .

Transaparent Tables Pool Tables Cluster Tables

Contain a single table. Used to

store master data

They are used to hold a large

number of very small

tables(stores system data).

They are used to hold data from

a few number of large tables.

(stores system data).

It has a one-to-one relationship

with a table in the database.

It has a many-to-one

relationship with a table in the

database.

It has a many-to-one

relationship with table in the

database.

For each transparent table

there is one associated table in

the database.

It is stored with other pooled

tables in a single table called

table pool in the database.

Many cluster tables are stored in

a single table in the database

called a table cluster .

The database table has the

same name, same number of

fields and the fields have the

same names .

The database table has

different name, different

number of fields and fields have

different names.

The database table has different

name, different number of fields

and fields have different names.

There is only a single table . Table pools contain more tables

than table clusters .

Contains less tables than table

pools .

Secondary indexes can be

created .

Secondary indexes cannot be

created .

Secondary indexes cannot be

created .

Page 20: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 20/31

Table Validations using check

tableWhat is a check table in SAP ? Data validations on SAP tables using check

table, creating check table in SAP

What are table validations ?

Table validation is a concept through which we can restrict invalid entries in a table.

Possible methods/concepts for table validation1. Field Level validations: We can validate entries at field level with the help of check table

concept.

2. Domain level validations: We can restrict entries at domain level with the help of fixed values

of domain and value table of domain.

What is check table ?

It is a table which contains all valid entries of a field.

What is value table ?

It is a table which contains all valid entries of a domain, this domain can be reused in multiple

tables.

What are fixed values for domain ?

These are allowed values for a domain ex: GENDER (domain).

Creating check table for table validations.Step1: Go to SE11, create a table ZSTUDENT_CHECK as

below

Go to SE11, provide name as ZSTUDENT_CHECK and click on create.

Page 21: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 21/31

Provide delivery class and display maintenance allowed.

Go to fields tab and add field as below

Page 22: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 22/31

Click on technical settings button and provide data class and size category.

Page 23: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 23/31

Go to utilities- table contents - create entries add some entries to the table.

Page 24: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 24/31

Similarly add some more entries.

Step2: Add ZSTUDENT_CHECK as check table for

ZSTUDENT_TABLE

Go to SE11, provide table name as ZSTUDENT_TABLE( which we have created already in our

previous lessons, if not create a table)

Go to tab Entry help/check, select city fields and click on foreign key icon.

Page 25: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 25/31

Provide short text, check table name ZSTUDENT_CHECK and click on generate proposal and

click on copy.

A check table will be added for CITY field

Page 26: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 26/31

Save and activate the table(If you get a warning popup when activating just press no).

Now go to utilities - table entries -> create entries

Provide a city name which is not in ZSTUDENT_CHECK table and try to save, it will trough an

error.

Page 27: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 27/31

Fixed Values for domain in SAPSAP Table screen entries can be restricted using domain fixed values, we can maintain domain

fixed values at domain level when creating a domain.

Create domain with fixed values

Go to SE11, select domain, provide name as ZGENDER, click on create.

Provide short description, data type and length as below and click on value range tab.

Page 28: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 28/31

Provide fixed values.

Save and activate.

Create data element with domain

Go to SE11, select data type, provide name as ZGENDER, click on create .

A popup will come, select data element and press enter.

Page 29: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 29/31

Provide short description, domain and click on field label.

Provide field labels

Save and activate

Page 30: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 30/31

Add a field in table

Go to SE11, provide a table name ZSTUDENT_TABLE(we have already created, if not create

table ) and click on change

Go to fields tab and add a field as below.

Save and activate

Go to table utilities- table entries - create entries

Page 31: 4-Data Dictionary.doc

7/23/2019 4-Data Dictionary.doc

http://slidepdf.com/reader/full/4-data-dictionarydoc 31/31

Provide values other than M, F and N, it will through an error .