Thursday, May 5, 2011

ABAP - Data Dictionary Introduction

Data dictionary provide:
1. Table definition
2. Type definition

Data dictionary can be accessed by transaction code SE11. (SAP Menu->Tools->ABAP Workbench->Development->Data Dictionary).

Table definition.
Display table definition.Go to Transaction Code SE11, enter table name (example: SFLIGHT), click Display.

You can assign the data type, length and short text in different ways:
1. You directly assign the field a data type, field length (and if necessary decimal places) and short text in the table definition.
2. You can assign the field a data element. The data type, field length (and decimal places) are determined from the domain of the data element. The short description of the data element is assigned to the field as a short text. In above case, all fields refer to data element (Field CARRID refer to date element S_CARR_ID). We will explain about data element in Type Definition below.To toggle beetween data element / direct type method click button "Data Element/Direct type".
To display table content, click Utilities -> Table Contents -> Display, then click Execute (F8).
Type DefinitionWe can define type as reusable object. It means that when we create new table, we can create field refer to data element. These type attributes can either be defined directly in the data element or copied from a domain. Data element is an object where we put short text for field, and domain is an object where we store information like data type (CHAR, NUMC) and its length. We can see relation beetween table field, data element and domain in figure below.

Benefit of using this hierarchy is when you change domain, for example change field length, it will change all field length for all table using this domain.
To open a data element, go to TCode SE11, select data type, and enter data element name (for example S_CARR_ID). You will see in this screen that data element S_CARR_ID refer to domain S_CARR_ID ( in this case, data element and domain have a same name), and also display field label tab, it contain short text that appear in short text of table field.
To open a domain, go to TCode SE11, select domain, and enter domain name (for example S_CARR_ID), you will see that this domain have CHAR (character) data type and field length 3.

No comments: