Você está na página 1de 30

ABAP Dictionary&ABAP OO BY

NAGARAJU MEESALA

2010 Wipro Ltd - Confidential

Agenda
1 Overview of SAP R/3 2 ABAP Data Dictionary Overview 3 Internal table concept 4 Object Oriented ABAP

2010 2010 Wipro Wipro Ltd Ltd - Confidential Confidential

What is SAP R/3

2010 Wipro Ltd - Confidential

SAP R/3 High-level Architecture


Presentation Layer SAP GUI Web Browser

Application Layer Application Server(1..n) Message Server Database Layer

Database Management Server Database

2010 Wipro Ltd - Confidential

SAP R/3 High-level Architecture


Presentation Layer
Interface between SAP System and the User Display User Interfaces using SAP GUI or Web Browser

Application Layer
Software Components that runs ABAP programs. Business Logic and processing Message Server provide the communication between Application servers

Database Layer
A Central database, which stores SAP Master data, Transaction data,etc. All SAP Programs, Screen definitions, etc. will be stored in the database, a special area called as Repository. Direct Access of Database is restricted.

2010 Wipro Ltd - Confidential

SAP Web AS ABAP Architecture


Web Browser SAP GUI

ICM

Dispatcher

Gateway

Shared Memory

Work Process

Context 1..n

Database Management Server Database

2010 Wipro Ltd - Confidential

SAP Web AS ABAP Architecture


ICM
Internet Communication Manager to directly handle the http requests through web. ICM will dispatch the request dispatcher based on the URL requested.

Dispatcher
Dispatcher provides the link between the work process and logged in user. Dispatch the requests to the free work process.

Gateway
To communicate with the other Application servers Internally within the Same System. Communicate with the other SAP Systems and Non-SAP Systems

Work Process
Work processes are components that executes application.

Context
Context contains the data for the application.

2010 Wipro Ltd - Confidential

ABAP Data Dictionary Overview

2010 Wipro Ltd - Confidential

Overview of Data Dictionary


The ABAP Dictionary centrally describes and manages all the data definitions used in the system. The ABAP Dictionary is completely integrated in the ABAP Development Workbench. All the other components of the Workbench can actively access the definitions stored in the ABAP Dictionary. The most important object types in the ABAP Dictionary are : Tables Views Types (data elements, structures, table types) Domains Search helps Lock objects
9
2010 2010 Wipro Wipro Ltd Ltd - Confidential Confidential

Basic Dictionary Objects


Tables - collection of records of data in fields. Data elements - contain the semantic definition (e.g. short
description) of what is contained in a field.

Domains - describe the technical attributes of the tables


fields (e.g. field type, length, value range, etc.).
Table
Table field

Data Element

Domain

uses
10
2010 2010 Wipro Wipro Ltd Ltd - Confidential Confidential

uses

FIELD AND DATA ELEMENTS

11

2010 2010 Wipro Wipro Ltd Ltd - Confidential Confidential

ABAP Data Types


Data Types

Predefined Data Types

Local Data Types

Global Data Types

ABAP DATA Dictionary Objects

ABAP Dictionary Type Group

12

2010 2010 Wipro Wipro Ltd Ltd - Confidential Confidential

ABAP Data Types


Predefined Data Types
Always available During the runtime Not required to declare in the program. e.g. SY-UNAME

Local Data Types


Defined and visible inside the program only .

Global Data Types


Defined the ABAP Dictionary Available System wide

13

2010 2010 Wipro Wipro Ltd Ltd - Confidential Confidential

LOCK OBJECTS
Lock Objects are used to synchronize access to the same data by more than one user.

Function modules that can be used in application programs are generated from the definition of a lock object in the ABAP Dictionary. Activating a lock object in the ABAP Dictionary automatically creates function modules for setting (ENQUEUE_<lock object name>) and releasing (DEQUEUE_<lock object name>) locks. You can then set and release SAP locks in your ABAP program by calling these function modules in a CALL FUNCTION statement.

14

2010 2010 Wipro Wipro Ltd Ltd - Confidential Confidential

Search helps
Two Types of Search helps
Elementary Search help Collective Search help

For all system defined tables by default a search help is automatically created and called. We have to define the search helps for the user-defined tables.

15

2010 2010 Wipro Wipro Ltd Ltd - Confidential Confidential

Structures and Aggregated Objects (Views)


Besides defining tables stored in the database, you can also define the structure of data which occurs when performing calculations in programs, or when passing data between programs. While data Structures are defined and activated in the ABAP/4 and be permanently stored in the database, data in structures exists only during the runtime of a program. Aggregated objects are objects which come from several different tables. Views are application-specific views of different ABAP/4 Dictionary tables. Views allow you to gather information from fields of different tables and present it to users in the form they require.
16
2010 2010 Wipro Wipro Ltd Ltd - Confidential Confidential

FOREIGN KEY:
You can define the relationships between tables in the ABAP Dictionary by creating foreign keys. Using foreign keys, you can easily create value checks for input fields. Foreign keys can also be used to link several tables in a view or a lock object. A foreign key permits you to assign data records in the foreign key table and check table. One record of the foreign key table uniquely identifies one record of the check table using the entries in the foreign key fields

17

2010 2010 Wipro Wipro Ltd Ltd - Confidential Confidential

Internal table concept

18

2010 2010 Wipro Wipro Ltd Ltd - Confidential Confidential

INTERNAL TABLES:
PURPOSE: Internal tables provide a means of taking data from a fixed structure and storing it in working memory in ABAP. In ABAP, internal tables fulfill the function of arrays. Since they are dynamic data objects, they save the programmer the task of dynamic memory management in programs. A particularly important use for internal tables is for storing and formatting data from a database table within a program. Same SAP database is accessed by all the departments in the organization and when each department wants to use the same information in different way internal table feature comes into play, where we can use the data the way we need to use.
19
2010 2010 Wipro Wipro Ltd Ltd - Confidential Confidential

FEATURES OF INTERNAL TABLE


Memory Allocation is Dynamic

The data is stored line by line in memory and each line has same structure, so that the accessing of the records from the internal table is also record by record. A particularly important use of internal table is for storing and formatting data fro ma database within a program and manipulate according to the user requirements.

SYNTAX TO DECLARE INTERNAL TABLE.


DATA <ITAB> TYPE TABLE OF <DATATYPE>.

20

2010 2010 Wipro Wipro Ltd Ltd - Confidential Confidential

Object Oriented Concepts in ABAP

21

2010 2010 Wipro Wipro Ltd Ltd - Confidential Confidential

OBJECT ORIENTATION:
The object-oriented approach, however, focuses on objects that represent abstract or concrete things of the real world. Object Oriented Characteristics:
Abstraction Encapsulation Inheritance Polymorphism

22

2010 2010 Wipro Wipro Ltd Ltd - Confidential Confidential

ABAP Class
Classes in ABAP Objects can be declared locally and globally. An ABAP Class contains a definition and Implementation
Class Definition
CLASS <Classname> Definition . ENDCLASS.

Class Implementation
CLASS <Classname> Implementation . ENDCLASS.

Class Visibility : Public, Private, Protected and Abstract. To instantiate the Class object
Data <obj_ref> type <class_name> Create object <obj_ref>.

23

2010 2010 Wipro Wipro Ltd Ltd - Confidential Confidential

ABAP Class Types

Class Types
Usual ABAP Class
Normal ABAP Class.

Persistent Class
Class with O/R ( Object-Relational) Mapping.

Exception Class

Class based Exceptional Handling.

Test Class
Test Class, cannot be instantiated.

We Can define final classes, cannot create subclass for final class. Instance and Static components
Static components will be declared with keyword CLASS-DATA.

24

2010 2010 Wipro Wipro Ltd Ltd - Confidential Confidential

INHERITANCE

Purpose of inheritance is to reuse the existing classes in the new classes except the private section of the inherited class. Derived classes inherit the data and methods of the superclass. However, they can overwrite existing methods, and also add new ones. Inheritance allows you to derive a new class from an existing class. This can be done using the INHERITING FROM. SYNTAX: CLASS subclass DEFINITION INHERITING FROM superclass.

25

2010 2010 Wipro Wipro Ltd Ltd - Confidential Confidential

POLYMORPHISM :
Polymorphism is supported through interfaces in SAP.
CREATION OF OBJECTS :

When a class reference variable cref is defined with reference to a class, an instance (object) of the class can be created

SYNTAX :
CREATE OBJECT cref [TYPE class].

26

2010 2010 Wipro Wipro Ltd Ltd - Confidential Confidential

DEFINING INTERFACES
Like classes, interfaces can be defined either globally in the Repository or locally in an ABAP program. The definition contains the declaration for all components (attributes, methods, events) of the interface. The components of interfaces do not have to be assigned individually to a visibility section, since they automatically belong to the public section of the class in which the interface is implemented. SYNTAX for defining Interfaces : The definition of a local interface intf is enclosed in the statements: INTERFACE intf. ... ENDINTERFACE.

27

2010 2010 Wipro Wipro Ltd Ltd - Confidential Confidential

TRIGGERING AND HANDLING EVENTS:


To trigger an event, a class must
declare the event in its declaration part. Trigger the event in one of its methods. DECLARING EVENTS: Events are declared in the declaration part of the class or the interface. Syntax to define the event.
EVENTS evt EXPORTING... VALUE(e1 e2 ...) TYPE [OPTIONAL]..

To declare static events, use the following statement:


CLASS-EVENTS evt...

28

2010 2010 Wipro Wipro Ltd Ltd - Confidential Confidential

TRIGGERING aEVENTS
An instance event in a class can be triggered by any instance method in the class. Static events can be triggered by any method but static methods can only trigger static events .
Syntax to Trigger the event
RAISE EVENT evt EXPORTING e1 = f1 e2 = f2 ...

HANDLING EVENTS Events are handled using special methods. To handle an event, a method must be defined as an event handler method for that event be registered at runtime for the event.

29

2010 2010 Wipro Wipro Ltd Ltd - Confidential Confidential

Thank You

30

2010 2010 Wipro Wipro Ltd Ltd - Confidential Confidential

Você também pode gostar