Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

data class

Former Member
0 Likes
776

explain data class,primary key and foreign key

6 REPLIES 6
Read only

Former Member
0 Likes
684

Hi,

Check below links

[Data Class|http://help.sap.com/saphelp_erp2004/helpdata/en/cf/21eac5446011d189700000e8322d00/content.htm]

[Primary Key|http://www.sapdb.org/htmhelp/54/91973b7889a326e10000000a114084/content.htm]

http://www.ncsu.edu/it/mirror/mysql/doc/maxdb/en/3c/384c4005a99523e10000000a1550b0/content.htm

[Foreign Key|http://help.sap.com/saphelp_nw70/helpdata/en/cf/21ea77446011d189700000e8322d00/frameset.htm]

Best Regards,

Brijesh]

Read only

Former Member
0 Likes
684

Hi

Data Class:- The data class defines the physical area of the database( i.e. tablespace ) in which the table should be created.

3 types of data classes:

1) APPL0 (master data) - It seldom changes. It is also known as master data. eg - data contained in an address file.

2) APPL1 (transaction data) - It changes frequently. eg - goods in a warehouse which changes after each purchase order.

3) APPL2 (organizational data) - It is the customized data that is defined during the system installation and seldom changes.

eg - table with country codes.

Primary Key:- Primary Key is the unique value column in a table which is used to identify the records in the table.

No two values in the primary key will be same and it can't have NULL values also.

Foreign Key:- To define a relationship between two tables, Foreign Key is used. A foreign Key links two tables.

For eg : Take two tables T1 and T2. T1 has a field F1 which is unique. T2 has a field F2 which has ths same data type as F1.

To create a link between T1 and T2, we'll make F2 as Foreign Key which will refer to F1 of table T1. Now, we can enter only those values in F2 which are present n F1. Values entered in F2 will be checked first with F1.

Hope this helps.

Regards

Natasha Garg

Edited by: Craig Cmehil on Jul 4, 2008 10:32 AM

Read only

Former Member
0 Likes
684

Hi,

Each data class corresponds to a physical area in which all the tables assigned to this data class are stored.

When you createa table then if you assing a data class to that table then table is automatically assigned to the correct area (tablespace or DBspace) of the database when it is created.

This means the table which you created is to store some master data . You can store it in masterdata (APPL0). Using this when you read this table from Database then it seraches directly in the area where Master tables are stored.

If you created a table, and that table you are modifying the data or entering data i.e changing frequently.Tthen you store this table in APPL1.

So, When you want to fetch data from this table then Database brings these records directly from this area. It will not search all areas .

Finally why to maintain this is to improve the performance.

Regards,

Rajitha.

Read only

Former Member
Read only

Former Member
0 Likes
684

Hii!

Data class logically defines the physical area of the database in which your table should be stored. If you chosse the data class correctly, the table will automatically be created in the correct area on the database when it is activated in the ABAP Dictionary.

The most important data classes are:

MASTER DATA is the data that is only seldomly modified.

TRANSACTION DATA is the data that is frequently modified.

ORGANIZATIONAL DATA is the data that is defined during the customizing when the system is installed and that is only seldomly modified thereafter.e.g Country keys.

SYSTEM DATA is the data that the SAP system itself needs.

CUSTOMER DATA CLASSES are provided for customers,they are used for customer developments.

PRIMARY KEY => A table can have one or more key fields called primary key. The values of these key fields uniquely identify a table entry.

FOREIGN KEY => A combination of fields in a table is called a foreign key if this field combination is primary key of another table. A foreign key links two tables.Foreign keys are used to ensure that the data is consistent. Data that has been entered is checked against existing data to ensure that it is consistent.

Regards

Abhijeet Kulshreshtha

Read only

bpawanchand
Active Contributor
0 Likes
684

HI

Primary Key

A primary key is a field or combination of fields that uniquely identify a record in a table, so that an individual record can be located without confusion.

Foreign Key

A foreign key (sometimes called a referencing key) is a key used to link two tables together. Typically you take the primary key field from one table and insert it into the other table where it becomes a foreign key (it remains a primary key in the original table).

Data Class

While when you talk about data class in ABAP DDIC it is the what decides that where it exactly has to store the data in the underlying database. Since in the underlying database each type of data class tables are stored differently

APPL0 Master data

APPL1 Transaction data

APPL2 Organizational and customizing data

Regards

Pavan