Showing posts with label ABAP data dictionary. Show all posts
Showing posts with label ABAP data dictionary. Show all posts

Friday, 5 April 2013

ABAP Dictionary

ABAP data object are stored at application server while the actual data resides at database server.


ABAP Data Dictionary is the Central source of data of SAP system OR ABAP dictionary is the central core component which supports the creation and management of all the data definitions used in the system. ABAP Dictionary is completely integrated with the ABAP development workbench and is active in the development and run-time environments of the SAP system. This ensures that any changes made in the data definitions results in subsequent changes in the all related ABAP programs, function modules, menu, screen painter or any other application where it has been used.  
The major object types in the Data Dictionary are Database tables, views, data type (data elements, structures, table types), domains, search helps and lock objects. The user can create, modify or delete the data definitions using the above objects.
Please note that ABAP Dictionary contains Metadata (Data about data) about the data stored in SAP R/3 system. Thus the definition of the ABAP data object are stored at application server while the actual data resides at database server. The main aim of ABAP Dictionary is to improve the system performance by minimizing the overall database hits and provide a layer of abstraction between the various layers of R/3 system.
To open ABAP Dictionary from the SAP Easy Access Menu Go-To Tools->ABAP Workbench->Development and then Double Click the ABAP Dictionary option listed.  Alternatively, you can do so by entering the transaction code for ABAP Dictionary SE11 in the command field. The transaction SE11 provides you with all the important objects of ABAP Dictionary. However there are other transactions fromSE13 to SE17 for specific purpose related to Dictionary view or modification.

ABAP Dictionary
ABAP Dictionary



The SAP R/3 system comes loaded with the basic business functionality usage data objects. However if you want you can create your own data objects as well. These are called as user defined types. But before creating any of user defined data objects ensure that the one you are creating is already provide by SAP or else you might end up duplicating the object and hence inefficiently utilizing SAP’s features.

A brief Introduction ABAP Dictionary Objects

  1.  Database Table- A table is multi dimensional matrix which is used to store data. There are 3 layers of data description of ABAP data dictionary which is to isolate the end users and even developers from the underlying database management system. The three layers of data description are:-
  •      External Layer – This is the end user view of the database. It mainly consists of how the user sees and interacts with the data. 
  •  ABAP Layer – The ABAP/4 layer describes the data formats used by the ABAP/4 processor. This is the developer’s/programmer’s view of the database. 
  • Database Layer – It is the DBA view of database. It describes the data formats used in the database.
In R/3 database there are two types of tables:- A. Client Dependent  B. Client Independent
  • Client Dependent- Database Tables with their first field name as 'MANDT' and type as 'CLNT' are client dependent tables.
  • Client Independent- All the tables with the first field name is not "MANDT' are client Independent, or in other words, all the tables which are not client dependent are client Independent.
The data in client dependent table is stored and retrieved based on the client number of the user. This is helpful in the scenario where we want developers and testers data to be different. 

Based on SAP R/3 system there are three types of tables: - A. Transparent Table, B. Pool table C. Cluster Table.
A-Transparent Table: - These tables have the same structure both in the ABAP dictionary as well as in the underlying Database.  It means that there is a one to one mapping between the two and the both the dictionary table and database table shares the same name, number of rows and columns. As we create a Transparent table in the Data Dictionary a similar structure table is created in the underlying database as well.
Transparent tables are mainly used to store application data which is basically the master data or transactional data of table. And mostly, transparent tables are the only one you will create as pooled and cluster tables are not used to store transaction data.
E.g.:- BKPF, VBAK, VBAP, KNA1, COEP etc
B- Pool Table: - A pool table means a pool of tables of the data dictionary representing a single database table. There is a many to one relationship between the data dictionary and database and the names of table in ABAP dictionary are different from the one in database.  Pool tables are used to store system data and system configuration. A Pool table is stored along with other pooled tables in database as table pool.
E.g. of Pool Table: - M_MTVMA, M_MTVMB

C- Cluster Table: - Cluster Tables are similar as the pool tables while the only difference between the two is that all the pool table stored in table pool does not need to have any foreign key relationship but in the case of cluster table it are must. Cluster tables can be used to store control data.  They can also be used to store temporary data or texts, such as documentation.
E.g.  Of cluster table BSEC, BSET, BSEG. 

 2.VIEW: - A VIEW in SAP is same as in other programming languages. A VIEW is a table with no contents. A view could also be representation of data from 2 or more logically related tables combined using joins or any other database operations. A View is mainly used to either display data from two or more tables or to project only selected fields of tables. We can use a view either separately (through SE11) or we can use it in any report we create (SE38) There are four types of Views in SAP: -

A.      Database View- A database view is the one which we create to display logically related data distributed among various tables.

B.      Projection view- A projection view is the one which we create to display only selected fields of a table. You cannot define any select conditions or joins in the projection view.

C.      Maintenance View- Maintenance like database view displays application data from multiple tables but the tables in maintenance view must be connected through foreign key relation.

D.      Help View- Help views are created to provide Input Help(F4) for any field in selection screen. Please Note that we can only use Help view if we need to retrieve data from tables combining them using Outer Join.

3.       Domain: - Domain defines the technical attributes of a field such as the data type, length and value range of field. For e.g. A Domain ‘ID’ is of data type ‘Integer’, length ‘4’ and value range 1 to 9999.  

4.       Data Elements: - Data elements define the semantic characteristics of a field. A data element contains field labels and Documentation (F1) of the field. A data element consists of a domain and the short description about the domain for which it is defined.
For e.g. A data element ‘Employee Id’ for employee table has a domain ‘ID’ defined and the short text defined as ‘Employee ID for employee of XYZ company’.

5.       Structure: - Structures are complex data types composed of multiple fields including data elements, table types or other structures. Structures are mainly used when we want to retrieve the records from database tables and alter them for modifying database or for displaying it to users.

6.       TYPE GROUPS – Suppose, we require a group of data types or 2 or more structures or both for more than one programs. Then instead of declaring them individually I each program we can create a type pool or type group of them. Type groups allows us to define the data types or structures in data dictionary.
Syntax:-


TYPE-POOL ZDEMO .

TYPES: BEGIN OF ZDEMO_ZTEST_5005874DEM ,
EMPID TYPE INT4,
EMPBRANCH TYPE C LENGTH 20,
NAME TYPE C LENGTH 20,
LNAME TYPE C LENGTH 20,
DEPTID TYPE INT4 ,

END OF ZDEMO_ZTEST_5005874DEM.

TYPES : BEGIN OF ZDEMO_ZTEST_505874TEST,
DEPTID TYPE INT4 ,
DEPTNAME TYPE C LENGTH 20,
END OF ZDEMO_ZTEST_505874TEST.

7.       Search help: - Search helps provides advanced input helps to user for selecting input fields based on the conditions used to create search helps.

8.       Lock Objects:- It implement application-level locking when changing data.

Saturday, 23 March 2013

ABAP Workbench Tools



As an ABAP guy you would spend most of your time on the ABAP workbench. So it’s important for you to know about the tools of ABAP workbench.
The ABAP Workbench is a collection of tools used to develop, test and run ABAP programs. It is a Programming environment GUI in SAP to develop different business applications using ABAP language.

ABAP Workbench Tools - Quick Guide

Tool
Information
Object Navigator
Transaction SE80; Used to navigate around the workbench. 
ABAP Editor
Transaction SE38; Here you can create or modify ABAP code and other implementations
Function Builder
Transaction SE37; use to create, test, and administer function modules.
Class Builder
Transaction SE24; for building Class objects
Screen Painter
Transaction SE51; use to design and manage screens and their elements used as Programming interfaces.
Menu Painter
Transaction SE41; for developing the Custom User Accessible menus on your screen interfaces
Message Maintenance
Transaction SE91; for creating standard output messages used within your program
ABAP Dictionary
Transaction SE11; used to create and manage data definitions (tables, structures, views) without redundancies.

Object Navigator

Object Navigator is the central point of entry into ABAP workbench as you can access any object of SAP system through it. In SAP all the Development objects are properly arranged together in an object list under some category such as packages, global class, programs etc. The transaction code to Open Object navigator is SE80.

Components of Object Navigator Interaface


We can choose browsers from Object Navigation area list. The various browsers are:-

  1. MIME Repository- Multipurpose Internet Mail Exchange Files Repository-  It displays all the directories with the MIME files which were imported into current system.
  2. Repository Browser - It displays repository objects (Please note that all ABAP programs are Objects to SAP) in the form of object list which are organized by selection categories like programs, packages, classes etc. This is the default displayed browser by object navigator.
  3. Repository Information System- Unlike Repository browser it displays all the available objects from information system without any search category.
  4. Tag Browser displays all the TAGs for web-apps.
  5. Transport Organizer- It displays the Transport request sent to it by user based on the request or task number.
  6. Test Repository-  Displays results of the test cases after testing repository objects.

    Object Navigator facilitates users to perform the following tasks: 
  1. Select a browser and navigate in the object list.
  2. Use the tools for development objects
  3.  Navigate from one window to another window.
  4. Perform syntax checks in the integrated window.
  5. Open an object in a new session using an Additional dialog box.

 ABAP Editor

SAP has provided Transaction SE38  for ABAP editor. All the reports and includes and other programs are created/edited using this transaction. ABAPpers spend most of their time in the ABAP editor.

Function Builder

Transaction SE37 is used for accessing function modules. Through this we can access all the SAP standard function modules and we can also create our own 'Z' function modules.

Class Builder

Similarly to the function Builder is the class builder which is used for ABAP objects programming. We can access all the SAP standard classes and can as well create our classes using class builder. Transction code SE24 is used for this purpose.

Screen Painter

Screen Painter is mainly used for either creating forms or Dialog Programs. Screen Painter provides us with various tools like Text I/P O/P, box, table wizards etc which could be used to create our own GUI screens for programs. Screen painter is accessible via transaction code SE51.

Menu Painter

Menu Painter is used to design the user interfaces for the programs. Using Menu Painter we can customize the user menu. By default the SAP provides the user with all the available options for all the 'Z' programs we create. Now to change this or limit the user options we create our pf_status using transaction SE41 (Menu Painter) ans set the same PF_STATUS in our program.

Message Maintenance

Messages helps SAP system to communicate with the user. Messages of types Information-I, Error-E, Warning-W, Success-S could be displayed using message classes. To create a message class could be done at transaction- SE91. Then we could use the message class in our reports/Programs.

ABAP Dictionary

ABAP Dictionary is one of the important tools of ABAP Workbench. It is used to create and manage data
definitions without redundancies. ABAP Dictionary always provides the updated information of an object
to all the system components. The presence and role of ABAP Dictionary ensures that data stored in an
SAP system is consistent and secure. ABAP dictionary could be accessed via transaction SE11.