Escolar Documentos
Profissional Documentos
Cultura Documentos
NAGARAJU MEESALA
Agenda
1 Overview of SAP R/3 2 ABAP Data Dictionary Overview 3 Internal table concept 4 Object Oriented ABAP
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.
ICM
Dispatcher
Gateway
Shared Memory
Work Process
Context 1..n
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.
Data Element
Domain
uses
10
2010 2010 Wipro Wipro Ltd Ltd - Confidential Confidential
uses
11
12
13
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
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
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
18
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
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.
20
21
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
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
Class Types
Usual ABAP Class
Normal ABAP Class.
Persistent Class
Class with O/R ( Object-Relational) Mapping.
Exception Class
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
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
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
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
28
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
Thank You
30