SAP ABAP Data Dictionary Tables

DDIC
·         Abap Dictionary is a central repository where we define and maintain the objects which are related to database.
·         Define means creation of objects
·         Maintenance means changing and deleting the objects.

The objects are,
 Database table:
·         It is an object which stores data in the form of rows and columns.
·         Each row is called as record, and each column is called as field.
·         So, to define a table we have to define the fields first.
·         So, to define a field, we have to specify the below things.
                                          What is the DataType?  ↘------ Domain
Defining Field -----------What is the length?        
                                          What is the Description? ------- DataElement
                 Field = DataElement+Domain
Domain:
·         It is an object which specifies technical information such as data type and length for a field.
·         It also specifies sign, lower case, conversion routine, fixed values, and value table.
Data element:
·         It is an object which specifies semantic information such as field description, field labels (short, medium, long and heading) for a field.
Advantages of data element and domain:
·         Reusability: The same data element and domain can be reused by multiple table fields, instead of creating again and again.
These are also used in creating foreign key relationship, search help, ale-idoc’s. 



Key field: A field which is used to identify the record uniquely is called a key field. In a table there should be at least one key field. We can create ____ number of key fields.

Steps to create domain:
1. Go to SE11
2. Select Domain
3. Give a name, ex – ‘zcno’
4. Click on Create
5. Provide short description
6. Provide data type as CHAR and length as 10 .
7. Press enter
8. Save, check and activate

Steps to create data element:

1. Go to SE11
2. Select data type
3. Give a name, ex – ‘zcno’
4. Create -> select data element
5. Provide short description
6. Provide domain name as ‘zcno’
7. Press enter
8. Click on field label tab, specify short, medium, long and heading labels
9. Save, check and activate

Steps to create a table:

1. Go to SE11
2. Provide the table name ‘zcust_table’
3. Click on create

4. Provide description
5. Specify delivery class as ‘A’
6. Specify display maintenance allowed
7. Click on fields tab
8. Provide the field name, data element name as below

9.
10. Click on save
11. Click on technical settings button
12. Provide the details as data class -> APPL0, size category -> 0
13. Click on save and click on back

14. Save and activate the table

Creating records into the table:
• Go to SE11
• Give the table name and click on change
• Click on utilities -> table contents -> create
• Provide the cno, cname, city
• Repeat the same procedure and create the records

Displaying the table contents:
• Click on utilities -> table contents -> display
• Click on execute button
• The records will be displayed

Note: Sometimes we may get unpredictable errors in a table, due to adding or deleting the fields in a table. To solve the error follow the below steps.

• Go to SE14Provide the table name
• Click on edit button
• Click on ‘activate and adjust database button


Components of a TABLE :

Delivery class:
·         It specifies the type of the data that stored in a table.
·         The data can be business data or system data.
·         Business data means application data (master and transaction data).
·         The following options are available.
Delivery Class
ShortText
A
C
L
G,E,S,W

Application Table(Master& Transaction Data)
Customizing Table, Maintenance only Customer, not by SAP
Table for storing temporary data, delivery report
System Data
                             

Display maintenance:

It specifies whether the data should only be displayed or it can also be maintained.
Data maintenance means creation, deletion, and changing.
There are 3 options available.
• Display maintenance allowed: Data is displayed and maintained
• Display maintenance not allowed: Data is not displayed and not maintained
• Display maintenance allowed with restrictions: Data is displayed, but maintenance is given only for some users based on restrictions.

Data class: It specifies the physical area of a table inside the database


Depending on the table we are supposed to select the required option.
 The options available are,
DataClass
Description
APPL0
APPL1
APPL2
Master Data, Transparent Tables
Transaction Data, Transparent Tables
Organization & Customizing


Master data: The data which never changes or which changes very rarely is called master data.
Ex: cno, cname, city etc.
Transaction data: The day to day business data or the data which changes every day is called transaction data.
Ex: customer bank transaction data
Organization data: The data which is related to organization or company like how many company codes, plants, sales organization etc, is called organization data.
Size category: It specifies the max. Number of records that can be stored in a table.
The possible options are available as below.
Size Category
Number of data records of table expected
0
1
2
3
.
0 to 6,100
6,100 to 24,000
24,000 to 98,000
98,000 to 390,000
.........


In the real time we always set size category as ‘0’ OR ‘1’, because we have to use small amount of memory.
Suppose if the memory is not sufficient the system will automatically assign the same memory area as per the size category mentioned above.




Buffer/cache memory: It is a temporary memory to store the data. It is mainly used to increase the system performance.
The functionality of buffer is defined as below.

• The Tables request for the data
• The system will check whether the data is available in cache/buffer memory
• If it is available the data will be immediately given back to the table, thereby increasing the system performance
• Suppose if the data is not available, the request will be sent to database, and the response will be given back to buffer or cache memory to store a copy for future references
• After the copy is stored then the data will be given back to the table

Buffering options:
• Buffering not allowed: Data is not stored in buffer
• Buffering allowed but not switched off: Used by SAP
• Buffering switched on: Data is stored in buffer

By default buffering not allowed will be selected.
Buffering types:
• Single record buffer: Only first record or records which are read will be stored in the buffer
• Fully buffered: All the records will be stored in the buffer
• Generic Area: The key field’s data is called generic area. Only generic area data i.e. key fields data will be stored in the buffer

Log Data Changes: This Checkbox would define whether changes to the data records of the table are to be logged/recorded or not.
If checkbox is selected, then every change (Update/Delete) to an existing data record is recorded in the Standard Database Log table DBTABLOG.



CLIENT NUMBER
·         It is a unique number which is used to provide security to the data at the database level.
·         In the real time, Based on the client no only, usernames will be created and the access will be given.
·         In the real time, normally we use the client number (100,120), (200,220), (300,320).
·         The field name, data element, and domain for client number is ‘MANDT’.

Types of tables based on client number

Client Dependent Table
Client Independent Table
        I.            If the first field is MANDT, then it is   called as client dependent table.
      II.            This table stores data in specific client only
        I.            If the first field is not MANDT, then it is called Client Independent Table.
      II.            Data is stored in all Clients without Security.


Ex on Client dependent table:

1. Create a table by name zcust_table_dp with below fields.
2.
3. Create some records in the table and display them.
4. Now login to another client. Ex 810 client
5. Open the table and display the data
6. The data will not be available, because it is a client dependent table  



STRUCTURES IN ABAP
• It is a container of reusable fields
• Structures are defined in data dictionary
• Once the structures are defined we must include them in tables
• There are two options for including the structures in tables
    1. Include Structure.
    2. Append Structure.

Difference between include structure and append structure:

                        Include
                   Append
1. This option is used only with custom 
     Tables.
2.These Include structure are reusable by
    Multiple tables.
3. Just give Field name as .Include and
    DataElement as Structure Name.
1.This option is used only by
    SAP Tables.
2. These are not reusable.

3.Click on 'Append Structure'  Button
    To create Structure for add a field.


Ex on include structure:

Step 1: Create a structure by name ‘zaddr’ with fields city, country, postal code
1. Go to SE11Select data typeprovide a name ‘zaddr’
2. Click on create
2. select 'structure' and provide the description
3. Specify the fields and data elements
4.
   Component( Field Name)
   Component type( DE name)
       City
       Country
       Pcode
    REGIO
    LAND1
    PSTLZ

5. Save and activate


Steps 2: Include the structure in a table as below

1. Open any table which is already created
2. Provide the field name as ‘.include’, data element as structure name zaddr(which is created above)
3. Enter
4. The fields will be automatically copied



Ex on append structure: Business requirement:
Add a custom field ‘MNAME’ (middle name) to the standard SAP table ‘KNA1’ .
1. Open the table kna1 in display mode
2. Click on ‘append structure’ button
3. A pop-up is displayed, click on create icon
4. Provide the append name ‘zapp1’ and press enter
5. Provide the field name as ‘mname’ and data element as ‘zmname’
6. Save, activate and click on back
7. Check the field in the table, it will be available at the bottom



Currency and Quantity fields
• Currency and quantity fields are used to store currency amounts data and quantity data respectively.
• So, for every currency and quantity field we have to specify the corresponding units like INR or USD or EURO etc or KGS or EA or PC etc .
• CURR: It is the data type which is used to store the currency amount or price fields.
• CUKY: It is the data type which is used to store the corresponding units(INR or USD or EURO ) for the currency fields.
• QUAN: It is the data type which is used to specify the quantity for a material or stock.
• UNIT: It is the data type which is used to specify the units(KGS or EA or PC) for the quantity fields.

Ex on currency/quantity fields:
1. Open any table which is already created.
2. Add the below fields
3. Click on Currency/Quantity fields tab and specify Ref Tab Name and Ref Field Name.

    Field
DataElement
DataType
Ref.Table
Ref.Field
Amount
Amount_Units
Quantity
Quantity_Units
Zamount
Zamount_units
Zquantity
Zquantity_units
CURR(15,2)
CUKY(5,0)
QUAN(5,2)
UNIT(3)
ZCUST_TABLE

ZCUST_TABLE
Zamount_units

Zquantity_units

4. Save and activate the table

Foreign key relation
The relation between two tables for validating the data is called foreign key relation. Validation means checking whether the value is correct or not.

Check table:
A table which stores master data is called a check table.
Foreign Key Table :
A table which is linked with check table for validating its own data is called foreign key table.
Foreign key relation :
A relation between two or more tables for validating the data is called foreign key relation.



Steps for foreign key relation:

Step 1: Create a table by name ‘zcustomers’ with field’s customer number and customer name, also create some records.
Step 2: Create another table by name zcustomers_bank with fields cno, bankid and bankname.
Step 3: Create the foreign key relation as below
1. Open the table zcustomer_bank
2. Select cno field
3. Click on foreign keys button or Icon
4. Provide the check table name as zcustomer(master data table)
5. Click on generate proposal button
6. Click on copy button
7. Save and activate

Step 4: Unit testing
• Click on utilities -> table contents -> create
• Enter the invalid customer number and click on save
• The error message will be displayed

Real time ex on foreign key relation:


Domain with field values:
• It is an option to maintain some Fixed values inside the domain for validation
• It is used for validation at the domain level
• We have to maintain some fixed values at the domain, so that all the table fields will be referring to this domain will be checked against with the fixed values
• If, suppose we enter a wrong value for a field which refers this domain, then the system will check your value with fixed values. If the value is not available, then the system will raise the error message 
• This option is only used whenever the number of values are less than 10 or 15
• If the values are more than 15, we go for foreign key relation
• The main advantage of domain with fixed values is reusability

Ex on Domain with field values
1. Open the table zcustomer_bank
2. Add an extra field by name ‘gender’ with data element and domain as ‘zgender’
3. Now go to the domain ‘zgender’.
4. Click on value range tab
5. Maintain the fixed values as below
Fixed Values
Short Desc
M
F
Male
Female

6. Save and activate the domain and the table
7. Go to unit testing
8. Enter the invalid value for gender
9. The error will be displayed

VALUE TABLE:
A table name defined at the domain level so that all the table fields will be referring to the domain will be checked or validated with a single table called as value table.
The main advantage of value table is to automate the system for foreign key relation i.e. the system will automatically display check table name to generate foreign key proposal.
We should just click on YES button, so that value table is converted as check table.

Steps for value table:

STEP1 : Create a table zzcustomer with field cno and cname, also create some records
STEP2 : Define the check table name at domain level as below. Now check table is called as value table
1. Go to the domain zcno
2. Click on value range tab

3. Provide the value table as zzcustomer
4. Save and activate, domain and table
STEP3 : Create another table by name zzcustomer_bank with fields cno, bankid, bankname
STEP4 : Maintain the foreign key relation as below
• Open zzcustomer_bank table
• Select cno field and click on foreign key button
• A pop-up displayed as below with value table to be proposed for check table

• If we click on ‘yes’, foreign key relation will be automatically displayed
• If we click on ‘no’, it will not be displayed


Differences between check table and value table

Check Table
Value Table
1.It is defined at field level.
2.FK relation is not automatic, that means we must enter check table name.
1. It is maintained at Domain level.
2. FK relation not automatic, that means once we maintain value table , FK relation automatically generated.

Domain properties:

• SIGN: It is used to store the sign of a number, whether it is positive sign or negative sign
• Lower Case: This option is used to store a value in the combination of capital and small letters
• By default SAP will convert all letters into capital letters
• If we don’t want to convert all letters into capital letters, please select lower case option
• Conversion Routine: It is a sub-program or function module which is used to convert a value from internal format to external format and vice versa



Conversion routine function modules:
• Go to any domain, ex: MATNR
• The conversion routine will be displayed, ex: MATN1
• Double click on MATN1
• Two function modules will be displayed as below
• CONVERSION_EXIT_MATN1_INPUT: This function module is used to convert material number from external format to internal format.
• CONVERSION_EXIT_MATN1_OUTPUT: This function module is used to convert material number from internal format tot external format.



Table Maintenance Generator (SM30):

·         It is a standard SAP program created in the form of function modules to maintain mass or bulk amount of data instead of maintaining each and every record.
·         Maintenance means creation, deletion and modification.
·         It is also used for validating the table data using the concept of events.

Steps for TMG:
1. Create any table by name ‘zcust’ with mandt, cno, cname and land1
2. Save and activate the table
3. Click on utilities -> select table maintenance generator
4. Provide the details as below
5. Authorization group = &NC&
6. Function group = zcust (table name)
7. Maintenance type as one step
8. Click on find screen number button
9. A pop-up is displayed, just press enter
10. The screen number will be automatically proposed
11. Click on create icon
12. The TMG will be created in the form of function modules


Activating TMG:
• Go to SE80
• Select function group from the list
• Provide function group name (table name) and press enter
• Right click on function group name and select activate

Unit testing:
• Go to SM30
• Provide the table name
• Click on ‘maintain’ button
• Enter customer number, name and country for a single record or bulk amount of records.
• Click on save, the data will be saved

Validations with TMG:
Sometimes we want to validate the data by writing program logic.
In such cases we use events in TMG and validate the data
The validation are possible using the concept called events
There are around 39 events available
For each event we need to provide a routine name (sub-program name )
Inside the routine we have to write the ABAP code for validating the data

Events in TMG:
• Open the table
• Click on utilities and select TMG
• Click on environment -> modification -> events
• A new screen will be displayed
• Click on ‘new entries’ button
• Click on ‘help’ button on the first row, first column
• The 39 events will be displayed

Main Event
Short Desc
           01
           02
           03
           04
           05 
          ....
Before saving the data in the database
After saving the data in the database
Before deleting the data displayed
After deleting the data displayed
Creating new entry
.......

• Double click on any Event Name. Ex : 05
• Provide the routine name for above event in the second column and press enter

                     T(Event Name)
                  Form Routine
               05
            Znew_rec

New sub-program which will be created for writing the logic

Ex on validation: Business Requirement:

Raise an error message whenever a new record or customer is created without providing the country or land1.

1. Create a table by name ‘zkna1’ with kunnr, land1, name1 fields
2. Create a TMG as discussed above
3. Click on environment -> modifications -> events
4. Click on ‘new entries’ button
5. Select the event ‘05’ (creating a new record) and provide sub-routine name (sub-program name)

       T(Event Name)
Form Routine
Editor
        05
ZNEW_REC
......

6. Click on Editor.

8. Press enter 2 times (sub-program will be created automatically)
9. Write the below ABAP code

Form znew_rec.
If zkna1_land1 = ‘ ’.
Message ‘please enter country’ type ‘E’.
Endif.
Endform.

10. Save and activate

11. Click on back, save
12. Click on back, save
13. Click on save
14. An information message will be displayed as ‘function group can’t be processed’
15. Click on back -> back -> back
16. Go to SE80 and activate function group
17. Got SM30 and test it


Do visit https://www.youtube.com/watch?v=jJqTQmIr_Fo  for a better understanding on SAP ABAP DDIC Introduction
SAP ABAP Data Dictionary Tables
Previous
Next Post »

5 comments

Click here for comments
sriram
admin
7 June 2018 at 00:31 ×


Great blog.you put Good stuff.All the topics were explained briefly.so quickly understand for me.I am waiting for your next fantastic blog.Thanks for sharing.Any coures related details learn...
Oracle course in chennai

Reply
avatar
Unknown
admin
16 August 2018 at 00:14 ×


Excellent Information.To get awesome training in SAP MM,The creating experts is the best choice.The experts provides 100% real-time, practical and placement focused SAP MM Training in Chennai.
The team of SAP MM Trainers are SAP MM Certified professionals with more real-time experience in live projects.For more information visit :
real time sap mm training in chennai

Reply
avatar
logicaldot
admin
16 April 2019 at 09:56 ×

I love the way you write and share your niche! schools in north east delhiVery interesting and different! Keep it coming!

Reply
avatar
13 October 2020 at 05:11 ×

Want Experience certificate For Grow Your Career So Contact Now & Get All Details – 9599119376 Or Visit Website- https://fakeexperiencecertificateinpune.blogspot.com/

Reply
avatar
tutorssa
admin
4 July 2021 at 20:34 ×

You have a genuine capacity to compose a substance that is useful for us. You have shared an amazing post about Private Tutors Adelaide Much obliged to you for your endeavors in sharing such information with us.

Reply
avatar