table creation

30
7/30/2019 TABLE CREATION http://slidepdf.com/reader/full/table-creation 1/30 TABLE CREATION In Order to create tables go to the T-Code SE11. Database table Tables can be defined independently of the database in the ABAP Dictionary. The fields of the table are defined together with their (database-independent) data types and lengths. A table definition in the ABAP Dictionary has the following components: Table fields: The field names and the data types of the fields contained in the table are defined here. Foreign keys: The foreign keys define the relationships between this table and other tables. Technical settings: The technical settings define how the table is created on the database. Indexes: Indexes can be defined for the table to speed up data selection from the table.

Upload: eye-buch

Post on 04-Apr-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 1/30

TABLE CREATION

In Order to create tables go to the T-Code SE11.

Database table

Tables can be defined independently of the database in the ABAPDictionary. The fields of the table are defined together with their(database-independent) data types and lengths.

A table definition in the ABAP Dictionary has the followingcomponents:

• Table fields: The field names and the data types of the fields

contained in the table are defined here.

• Foreign keys: The foreign keys define the relationships between

this table and other tables.

• Technical settings: The technical settings define how the table is

created on the database.

• Indexes: Indexes can be defined for the table to speed up data

selection from the table.

Page 2: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 2/30

There are three categories of database tables in the ABAP Dictionary.

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 theABAP/4 Dictionary correspond.

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

A physical table definition is created in the database for the tabledefinition stored in the ABAP Dictionary for transparent tables when

the table is activated. The table definition is translated from the ABAP

Dictionary to a definition of the particular database.

On the other hand, pooled tables and cluster tables are not created

in the database. The data of these tables is stored in thecorresponding table pool or table cluster. It is not necessary to createindexes and technical settings for pooled and cluster tables.

Pooled table

Pooled tables can be used to store control data (e.g. screen

sequences, program parameters or temporary data). Several pooledtables can be combined to form a table pool. The table pool

corresponds to a physical table on the database in which all therecords of the allocated pooled tables are stored.

Page 3: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 3/30

Page 4: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 4/30

STEPS TO CREATE A TABLES:

1) For creating a table it always starts with Z or Y.

2) Give Short Description, Delivery Class and Data Browser/Table ViewMaintance.

Page 5: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 5/30

Delivery Class contains

Delivery class

The delivery class controls the transport of table data when installing

or upgrading, in a client copy and when transporting betweencustomer systems. The delivery class is also used in the extended 

table maintenance.

There are the following delivery classes:

•  A: Application table (master and transaction data).

• C : the customer maintains Customer table, data only.

• L: Table for storing temporary data.

• G: Customer table, SAP may insert new data records, but maynot overwrite or delete existing data records. The customer

namespace must be defined in table TRESC. (Use Report

RDDKOR54 here).

• E : System table with its own namespaces for customer entries.

The customer namespace must be defined in table TRESC. (UseReport RDDKOR54 here.)

Page 6: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 6/30

• S: System table, data changes have the same status as programchanges.

• W : System table (e.g. table of the development environment)

whose data is transported with its own transport objects (e.g.

R3TR PROG, R3TR TABL, etc.).

Behavior during client copy

Only the data of client-specific tables is copied.

• Classes C, G, E, and S: The data records of the table are copied

to the target client.

• Classes W, L: The data records of the table are not copied to thetarget client.

• Class A: Data records are only copied to the target client if 

explicitly requested (parameter option). Normally it does notmake sense to transport such data, but is supported to permit

you to copy an entire client environment.

Behavior during installation, upgrade and language import

The behavior differs here for client-specific and cross-client tables.

Client-specific tables

• Classes A and C: Data is only imported into client 000. Existing

data records are overwritten.

• Classes E, S and W: Data is imported into all clients. Existing

data records are overwritten.

• Class G: Existing data records are overwritten in client 000. Inall other clients, new data records are inserted, but existing data

records are not overwritten.

• Class L: No data is imported.

Cross-client tables

• Classes A, L and C: No data is imported.

Page 7: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 7/30

• Classes E, S, and W: Data is imported. Existing data records withthe same key are overwritten.

• Classe G: Data records that do not exist are inserted, but

existing data records are not overwritten.

Behavior during transport between customer systems

Data records of tables of delivery class L are not imported into the

target system. Data records of tables of delivery classes A, C, E, G, Sand W are imported into the target system (this is done for the target

client specified in the transport for client-specific tables).

Use of the delivery class in the extended table maintenance

The delivery class is also analyzed in the extended table maintenance

(SM30). The maintenance interface generated for a table makes thefollowing checks:

• You cannot transport the entered data with the transport link of 

the generated maintenance interface for tables of delivery

classes W and L.

• When you enter data, there is a check if this data violates the

namespace defined for the table in table TRESC. If the dataviolates the namespace, the input is rejected.

Page 8: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 8/30

Flag if Maintenance with Standard Tools is allowed

Definition

This indicator specifies whether it is possible to display/maintain a

table/view using the maintenance tools Data Browser (transactionSE16) and table view maintenance (transactions SM30 and SM31).

The indicator can be set for database views, projection views,

maintenance views, maintenance view variants, and tables (called'Table/ View' below) using transaction SE11.

Note: The indicator is not available for help views since they are not

relevant to SE54 and are used for search functions.

Usage

The indicator can have the following values:

• Display/maintenance not allowed

The usage of standard table maintenance tools is not allowed.

o Maintenance and display of this table/view is not possible

in transaction SE16.

o

Transaction SE54 does not allow the generation of amaintenance dialog, which means automatically that

calling transactions SM30/SM34 for this table/view is nolonger possible.

• Display/maintenance allowed to limited extent

Usage of standard table maintenance tools is allowed to a limitedextent:

o Transaction SE16 allows the display function for this

table/view, but no maintenance.

o Generation of a maintenance dialog for this table/view is

possible through transaction SE54.

o Transaction SM30 does not allow maintenance and display

functions for this table/view.

Page 9: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 9/30

Note: The generated dialog can be included in view

clusters (data maintenance through transaction SM34) orcalled within a program through the function module

View_Maintenance_Call.

• Display/maintenance allowed

The usage of standard table maintenance tools is allowed:

o Transaction SE16 allows the maintenance and display

functions for this table/view.

Note: If an SM30 maintenance dialog exists, this is called.

o Transaction SE54 allows the generation of a maintenance

dialog for this table/view.

o Transaction SM30 allows the display and maintenance

functions for this table/view.

Note: The generated dialog can be included in viewclusters (data maintenance through transaction SM34) or

called through the function module View_Maintenance_Callin the same way as the transaction call SM30.

CommentOnly the last two options are offered for maintenance views andmaintenance view variants. 'Display/maintenance not allowed' does

not apply since maintenance views and maintenance view variantsserve exclusively to generate a user interface. This is rejected in the

option 'Display/maintenance not allowed'.

When the standard maintenance tools are used, the system checks thecorresponding authorizations of the user

Page 10: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 10/30

3) Click on Fields Tab and enter fields.

4) Click on save and click on Technical settings

Page 11: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 11/30

It contains Data class and size category.

Data class in technical settings

The data class defines the physical area of the database (for ORACLE

the TABLESPACE) in which your table is logically stored. If you choose

a data class correctly, your table will automatically be assigned to thecorrect area when it is created on the database.

The most important data classes are (other than the system data):

• APPL0 Master data

• APPL1 Transaction data

• APPL2 Organizational and customizing data

Master data is data, which is frequently read, but rarely updated.

Transaction data is data, which is frequently updated. Organizational und customizing data is data, which is defined when the system is

initialized and then rarely changed.

There are two more data classes available, USR and USR1. These are

reserved for user developments. The tables assigned to these data

classes are stored in a table space for user developments.

Note: The data class only has an effect on table storage for the

database systems ORACLE and INFORMIX.

Page 12: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 12/30

Size category

The size category determines the probable space requirement for a

table in the database.

You can select the categories 0 to 4 for your table. Each category isassigned a specific fixed storage area value in the database. When you

create a table, initial space is saved for it in the database. If more

space is required later as a result of data that has been entered, thestorage space is increased in accordance with the category selected.

Press F4 on the field Size category to see the number of data recordsthat can be maintained for the individual categories of your tablewithout complications ensuing. These complications could be for

example a reorganization becoming necessary because the maximumspace to be reserved for the table was exceeded due to the maintained

size category.

Page 13: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 13/30

5) Then Click on Save and back

6) Then Click on Save, Check and Active

Page 14: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 14/30

7) If we want to enter the values into this table go to utilities -> Table

Content -> Create Entries.

8) Give entries here and then save. If you are not save then those are

saved in the database. If you want give 2nd entry save and then clickon Reset tab.

Page 15: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 15/30

9) If we want to see the data in that table which we are created then

Or click on Contents tab on menu bar.

Page 16: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 16/30

Then click on Execute Button on menu bar, it displays all the records,

which you are created.

Page 17: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 17/30

If we want to create more entries click on create tab.

CREATING FOEIGN KEY RELATIONSHIP

1) Create two tables as above, some conditions are

a) But there must be a common field in those two tables.

b) And also there must be Data Element.

See the creation of data element

Data element

A data element (elementary type) describes the technical attributes

and the contents of a table or structure field. Fields with the samecontents refer to the same data element.

A data element is a type and can be referenced in ABAP programs with

TYPE. For example, variables taking on the type attributes of a dataelement can be defined in an ABAP program.

Page 18: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 18/30

The type attributes of a data element (built-in data type in the ABAPDictionary, field length and possibly decimal places) are copied from

the domain of the data element.

Write data element name and double click on that data element. Thenit ask like this

Click on YES, SAVE and Continue

Page 19: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 19/30

Page 20: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 20/30

It asks Data element not available create the data element? Click on

YES.

Give Short Description and Domain name. And double click on Domain

Page 21: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 21/30

Object class domains

A domain (technical domain) describes the value range and formalattributes of a field.

The domain is used to define the value range of a field with formal

specifications, such as format and length, by defining fixed values or avalue table.

Note

Different fields, which are technically the same, can be combined toform a domain. Fields, which is linked by a reference to the same

domain, cannot be changed independently of each other.

Page 22: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 22/30

Page 23: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 23/30

Give Short description, Data type and No. Of Char.

In Abap there are 24 Data type. 90% of the field contains data type as

CHAR.

Page 24: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 24/30

Then Click on save, check and Activate

Page 25: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 25/30

Page 26: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 26/30

Page 27: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 27/30

And come back. Domain values automatically stored. Ok in this screenalso click on save, check and activate. And come back

Page 28: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 28/30

Create the same field with same data element in the 2nd table also. If 

we want to give foreign key relationship then click on foreign key in 2nd

table by placing cursor on common field.

 Give Check table name (i.e. 1st table name) and click on GenerateProposal.

Page 29: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 29/30

Then click on Copy it generates foreign key relationship. In same waygive technical settings and activate again.

While creating the entries it shows the possible entries to the common

field (those can created already while creating the 1st table).

Give values like this save and come back. Now the output is like this

Page 30: TABLE CREATION

7/30/2019 TABLE CREATION

http://slidepdf.com/reader/full/table-creation 30/30