Saturday, April 7, 2012

Data Dictionary,Buffering, Indexes in SAP ABAP

Data Dictionary it is a central repository, where we can define and maintain the objects which are related to database. Here we can create, update, delete the objects which are related to data base. SE11 is the TCODE for data dictionary. It is a utility for defining data objects.

Objects of Data Dictionary
Database table
View
Data element
Domain
Structure
Table type
Search Help
Lock Object
Type Group (Type Pool)
Table Pool / Table Cluster 



Types of Tables in SAP Data Dictionary


•Transparent tables.

•Pooled tables.

•Cluster tables.

Components of  a Database Table :

•Table object.

•Fields.

•Data element object.

•Domain object.

•Technical settings

Table Object : Represents a table in the ABAP data dictionary.

Fields : Define information stored in the table.

Transparent Tables :
 1.  A transparent table in the dictionary has a one-to-one relationship with a table in the database. Its structure in R/3 DDIC corresponds to a single  database table.
  
2. For each transparent table definition in the dictionary, there is one  associated table in the database.
  
3. Transparent tables are used to hold application data.( master or transaction data)

Data Element and Domain

Data Element : 
It is  a semantic characteristics of a table field  Data elements appear as objects in the dictionary.  Because they are objects in their own right, you can
reuse data elements within the same table or among fields in several tables.
    
It contains:

    - Domain name

    - Field label

    - F1 documentation : TCODE – SE61.

 Type name of document and  select document class & language.

Use this document name as a reference  to link with another document in 


which you have selected a text which is to be hyperlinked. Insert -> link -> 


document class, name.

Domain : 

    It is a technical characteristics of a field.  
    A domain specifies information like data type , length & decimal places. 
    Like data elements, domains are stored as objects in the Dictionary. 
    You can reuse domains just as you can reuse data elements.

Conversion Routines :

    These are the function modules used to convert the contents of a screen 
    field from display format to sap internal format (Input conversion) & vice 
    versa (output conversion). 

    It is automatically called when values are saved/displayed in screen field 
    which refers to domain with conversion routine & also when contents of field 
    are output with write statement.

    Conversion_exit_xxxxx_input.

    Conversion_exit_xxxxx_output.


Components of Table Delivery Class, Parameter ID, Data Class, 
Technical Settings, Size Category

Delivery Class : It is used during installation, upgradation, client copy, transporting between customer systems & in extended table maintenance. The value in delivery class field identifies the ‘owner’ of the data in this table.
     A – Application table
     C – Customizing table
     L – Table for storing temporary data
     G – Customizing table, protected against SAP updation
     E ,S,W – System table.

Parameter ID : A field can be filled with default value from SAP memory using a parameter ID. Fields referring to  data element are then automatically filled with this value in all subsequent screen templates.

Technical Settings :  Specify how the R/3 system handles a table.
  - Data class
  - Size category
  - Buffering permission
  - Buffering types

Data Class : It determines the tablespace. A tablespace is a physical file on
   disk that is used to hold tables. Every table is assigned to one  tablespace.
   Tables with similar characteristics are usually grouped into one tablespace.
    
    APPL0 – Master data
    APPL1 – Transactional data
    APPL2 – Organizational data
    USER,USER1 – Customer data class

Size Category : It enables you to specify the maximum no. of records 
(IN BYTES) you expect this table to hold.
  
- Initial extent
  
- First extent

- Second extent

Buffer Synchronization and Buffering Types


Buffer Synchronization :  

If you have two application server, the same record can be buffered on each 
server. 

If a buffered record is updated in one AS, it will update the DB. But the 
changes must be communicated to other AS. 

This is done in the process known as buffer synchronization, which occurs at 
1- 4 min. interval depending on your system configuration. 

At a predefined interval, each synchronization process checks the 
synchronization log on DB server to see whether any buffered data has been 
modified. 

Data that has been modified is marked invalid in buffer. The next time that new data is read from DB.


Buffering Permission

 -  Buffering not allowed : 
If application program needs most recent data from table or table is updated 
too frequently.

 -  Buffering allowed but switched off : 

  From technical point of view, buffering is permitted. Whether or not table buffering result in gain in performance depends on table size & frequency of 
  accessing table. 

  Buffering is switched off because it is not possible to know that these values will be in customer system. You can switched on buffering at any time if 
  buffering is advantageous for table size & access profile.

 -  Buffering switched on : If table should be buffered.

Full buffering: 

All records of table are loaded into buffer when one record of table is
    accessed.

Tables best suited for this are small (up to 30 KB), read frequently & rarely 
written. Generic/full table buffer TABL is used

Generic buffering: 

    All the records with respect to generic key fields are loaded into buffer. 
Generic key is a part of primary key that is left justified. Mention no. of key
fields.  Generic/full table buffer TABL is used

Single record buffering: 

Only the record that are actually read are loaded into buffer one by one.
Single record table buffer TABLP is used.

  
Buffering Database Tables

•You can reset the table buffers on application server by entering $TAB in 
command field. 

All the data in buffer is invalidated.It can take several hours in large systems.

•Only tables that are rarely written (read only) or for which temporary 
inconsistencies are of no significance should be buffered.Tables whose entries 
are frequently modified should not be buffered.

Otherwise there would be constant invalidation&reloading which would have 
negative effect on performance.

Runtime Object

    It contains the information about the object that is relevant for ABAP 
programs & screen. 
    
   It is generated the first time when object is activated & next version of object is adjusted after each time it is activated. 

   Tables, views, data element, structure, table type have runtime object. Time 
stamp ABAP (ABAP program ) & time stamp DYNP (screen) are used to ensure 
most up to date information.

Index and Database Utility(SE14)

Index : 

It is an efficiency mechanism for quickly finding rows within a table. 

It supportswhere clause in select statement to find a row. Row number to each 
record is assigned by the database internally. 

Primary index is created automatically with ID 0 (zero).

It consists of all Primary keys . 

Secondary index can be any other number or alphabetic character. 

When multiple index exist, RDBMS uses an optimizer to pick best one.
    
     - Max. 15 number of secondary index .

    - Avoid overlapping indexes.
  
     - Use SQL trace tool to find which index has been used (TCODE – ST05).
    
     - Do not add unnecessary indexes.

    - Make indexes very selective.

Database Utility: 

It is the interface between DDIC & database. It allows you to create,
    delete & adjust database objects from DDIC objects. 

Transparent tables, views,pools/clusters can be edited by using SE14
You can also edit index in SE14.
    
Processing Types:

   1.  Direct

   2.  Background

   3.  Mass processing 

- System table TBATG is used. Request  collected in this table is
  processed in background at fixed time.  

For Scheduling jobs,initial screen->extras->schedule job. 

For displaying request for mass processing, DB request->mass Processing.
    
If you want to activate a large set of objects simultaneously, you can use mass activation with program RADMASG0. 

Screen inputs are:
•Transport request

•External table – You can define table TACOB as external table.All objects in this table are activated.
•Direct objects – The objects to be activated can also be entered directly with an input screen template.

Activation Type
   It defines whether the table can be activated from ABAP dictionary directly or whether runtime object of table must be generated with C program.It is optional & only important for tables of runtime environment.
    - 01
    - 02
    - 10
    - 00 (default)
    Refer On line help. 

Restrictions on Tables

•Max 16 key fields allowed.

•Max length of table key is 255.

•Table may not have more than 249 fields.

•Sum of all field length is limited to 1962 (excluding length of LCHR & LRAW).

•Fields of LRAW or LCHR must be at the end of table.
Only one such field is allowed per table. 
There must also be a field of type INT2 preceding this field.

•If addition of all key length is larger than 64, the table can not be buffered generically. 
And if larger than 120,table can not buffered.

•CURRENCY & QUANTITY field should not be used as a primary key as buffering not possible, transport restricted.

Foreign Key and Primary Key

•The attribute ( or combination of one or more attributes ) which can uniquely identify the instance of a set is called  primary key.

•A foreign key is an attribute or set of attributes of a relation, such that the value of each attribute in the set is that of a primary key of the related set.

  Technical requirements for creating FK

•The corresponding field in check table must be primary key.

•The domain names for FK field and check table field ( or technical 
characteristics ) must be same.Data elements name may be different.

Generic & Constant FK

•Generic FK – A tick mark in generic check box causes a field to be ignored during FK check.

•Constant FK – If a constant value is entered on create FK screen, those 
record in check table which contains these constant values are valid for FK check. 

Cardinality and Foreign key field Type

Cardinality :

It describes, for each value in check table,how many rows of data are 
   allowed to be  in FK table.Cardinality is described as X:Y

X refers to the check table.Y refers to the foreign key table.
  The value of X means.

  1 : Deletion of master record from check table deletes corresponding 
records from the foreign key table.
  
C : Deletion of master record does not affect the foreign key table records.
  
The value of Y means:
  
1 : There is always one & only one row in foreign key table for each 
row in check table.
  
C : There is, at the most, one row in foreign key table for each row in the check table.
  
N : There is always at least one row in foreign key table for each row in  check table.
  
CN : There might or might not be rows in foreign key table for each row in check table.

Foreign Key Field Type:
   
- Not specified

   - Key fields/candidates.

   - Non-key fields/candidates.

   - Key fields of a text table.

• Cardinality & foreign key field type is mandatory only in

   - Text table

   - Help view

   - Maintenance view


Text Table and Value Table

Text Table : 
Table A is a text table (FK table ) of table B( Check table ) if 
   primary key of table A is same as primary key of  table B with the addition of a language key field ( data type LANG).

Table A  may therefore contain explanatory text in  several languages for each key entry of table B. Every table can have only one text  table. 

Always mention Foreign key field type ->key fields of text table and Cardinality -> 1 : N.

Value Table : Domain contains the value table option. It  automatically propose the check  table when creating a foreign  key relationship.

Reference Field :
   
CURRENCY field must be linked to a field of data type CUKY.
   
QUANTITY field  must be linked to a field of data type UNIT.
   Reference  table can be the same table or any other table.

Structures in Data Dictionary

Definition : 
A structure is a series of fields grouped together under a common name. 

• Difference between structures and tables :
     - A structure does not have an associated database table.
     - A structure does not have a primary key.
     - A structure does not have technical settings & indexes.

Types of structures :
    
1. Flat structure - A structure whose each field either refer to a data element or direct type.
    
2. Nested structure - A structure which refer at least one further structure.
    
3. Deep structure - A structure which refer at least one table type.

Adding Structures to a Table :
    
- .INCLUDE
    
- .INCLU-XXX ( group name & name suffix )
   
- APPEND STRUCTURE : 

The chain of structures created by including one structure within another is called an include chain. 

The maximum depth is nine & only one table type can be included in an include chain. 

APPEND structure is assigned to exactly one Table / structure. 

There can be, however, several APPEND structure to table/structure. 

The fields in append structure have a name starting with ZZ or YY.








Dear Friends if you know any real time interview questions please share in below comment box.



"You found the information helpful and want to say thanks? Your donation is enough to inspire us to do more. Thanks a bunch!"

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Categories

ABAP (1) ABAP Interview Questions (112) ABAP Open SQL Statements (1) ABAP Syntax Rules (6) ABAP WORKBENCH (2) ABAP-Interview-Questions (52) ALE IDOC (6) ALE IDOC Interview Questions (6) ale-idoc (6) ALE-IDOC-Interview-Questions (19) ALV Interview Questions (5) ALV-Interview-Questions (22) BADI (2) BAPI (1) BAPI Interview Questions (1) BAPI-Interview-Questions (14) BDC (6) BDC Interview Questions (6) BDC-Interview-Questions (9) big data (2) big data interview questions (1) Classical Reports Interview Question (3) Classical-Reports-Interview-Questions (22) Conditional Statements (1) Cross Applications (3) Cross-Applications (14) Data Dictionary (22) Data Type Questins (1) Data types (1) Data-Dictionary (48) Data-Type-Questins (6) Dialog programming (5) Dialog Programming Interview Questions (4) Dialog-Programming (30) DOMAIN Interview Questions (1) Domain-Interview-Questions (8) Function Module (2) hadoop (2) hadoop interview questions (2) hdfs (1) IDoc Tutorials (6) Interactive Report Interview Questions (4) Interactive-Reports-Interview-Questions (22) Internal Tables (1) interview questions (1) Lock Object Interview Questions (1) Lock-Objects-Interview-Questions (10) Logical Database (1) Modularization Interview Questions (4) Modularization-Interview-Questions (25) Module Pool Programming (5) Module-Pool-Programming (39) modules in sap (1) Object Oriented ABAP (19) Object Oriented ABAP Interview Questions (15) object-oriented-abap (2) Object-Oriented-ABAP-Interview-Questions (34) OOABAP (9) Reports (14) Reports Interview Questions (9) Reports-Interview-Questions (19) RFC (1) RFC Interview Questions (1) RFC-Interview-Questions (14) RICEF (1) RICEF Objects (1) SAP (4) SAP ABAP (4) SAP ABAP Interview Questions (42) SAP ABAP Introduction (46) SAP ABAP Message Types (2) SAP BADI Interview Questions (2) SAP Basics (71) SAP Books (2) SAP Certification (1) SAP CONSULTANTS (5) SAP CRM (1) SAP ENHANCEMENTS (3) SAP EXITS (2) SAP EXITS ( SAP ENHANCEMENTS ) Interview Questions (1) SAP Free Books (1) SAP HR (2) SAP Lock Object (1) sap modules (2) SAP Open SQL Statements (1) SAP R/3 Architecture (4) SAP Search help (1) SAP Smartforms (1) SAP Smartforms Interview Questions (2) SAP Tables (5) SAP Tcodes (10) SAP Views (1) SAP Webdynpro ABAP (12) SAP Work Processors (2) SAP Workflow (3) SAP-BADI-Interview-Questions (11) SAP-Enhancements (39) SAP-Exits (39) SAP-Exits-Enhancements-Interview Questions (3) SAP-HANA (1) SAP-HANA-Interview-Questions (1) SAP-Smartforms-Interview-Questions (2) SAP-Workflow (3) Scripts (3) Scripts Interview Questions (2) Scripts-Interview-Questions (32) Search Help Interview Questions (1) Search-Help-Interview-Questions (9) Smartforms (1) Table Maintenance Generator (1) Table-Maintenance-Generator (4) Tables in SAP (2) Tables Interview Questions (3) Tables-Interview-Questions (3) Type Group Interview Questions (1) Type-Group-Interview-Questions (7) Variable Declaration (1) Views Interview Questions (1) Views-Interview-Questions (5) Webdynpro (12) what is big data (1)

Protected Blog

 
This blog is not affiliated to SAP AG |SAP is trademark of SAP AG |The information collected from various sources use information with your own risk.