Beruflich Dokumente
Kultur Dokumente
Content
By Ahmed Saad
Introduction
The following diagram shows
the 3-tier architecture of SAP
R/3 system.
R3 Applications are written
using ABAP.
ABAP is used to communicate
the database management
system and SAPgui in the
presentation layer through the
application server .
Work Processes
Dispatcher
Gateway
Shared memory
Database connection
Work Processes
Every program run in as SAP system
is work process.
Independent of OS and database.
SAP basis consultants are
responsible for configuring SAP
system, in such a way, to manage
the number of work processes used
so as channels and connections to
database.
A memory area is dedicated to
each work process
The Dispatcher
Gateway
Each application server contains a gateway.
This is the interface for the R/3 communication
protocols (RFC, CPI/C).
It can communicate with other application servers in the
same R/3 System, with other R/3 Systems, with R/2
Systems, or with non-SAP systems.
Shared Memory
Common main memory area used by all work processes
in and application server.
Contains the resources that all work processes use
such as programs and table contents.
Memory management ensures that the work
processes always address the correct context (the data
relevant to the current state of the program that is
running).
Local buffering of data in the shared memory reduces
the number of database reads required.
Database Connection
Application server uses it to register its work
processes with the database layer, and receives a
single dedicated channel which cannot be changed
while the system is running .
So A working process make database changes within a
single database LUW.
ABAP
Advanced Business Application Programming
ABAP Syntax
An ABAP program consists of individual ABAP statements.
ABAP is not case sensitive.
(Ex. WRITE myDATA. Similar to Write MYDATA.)
Comments:
For placing a comment in the beginning of the line use (*) .
Ex. * This is a comment line
For placing a comment after the line use ().
Ex.
ABAP
Operating/Database system-independent
programming
ABAP contains a subset of SQL called Open SQL
for comfortable database access for various
database
ABAP Programming
ABAP Report
Dialog Programming (Transaction)
Chained Statements
WRITE Hello World.
WRITE OK.
=
WRITE: Hello World, OK.
DATA tmp1 TYPE I.
DATA tmp2 TYPE C.
=
DATA: tmp1 TYPE I,
tmp2 TYPE C.
Chained Statement
MOVE sy-subrc TO tmp1.
MOVE sy-subrc TO tmp2.
MOVE sy-subrc TO tmp3.
=
MOVE sy-subrc TO: tmp1,
tmp2,
tmp3.
Chained Statement
PERFORM cal_1 USING a1 a2.
PERFORM cal_1 USING a3 a4.
=
PERFORM cal_1 USING: a1 a2,
a3 a4.
Comments
* This is full line comment
WRITE Hello World. Write data (partial line comment)
WRITE Test.
Data
Objects
ABAP Data
Objects: They contain methods ,events
and data which are allocated and called during the
runtime.
They can be divided into classes and interfaces.
Object references, on the other hand, can be created
with reference to either classes or interfaces.
Variable
Structure
Internal Table
Table Structure
Constants
<Methods>
Data Types.
Elementary types are the smallest
indivisible unit of types (Fixed length,
Variable length).
Reference Type: Reference types
describe data objects that contain
references (pointers) to other objects .
Complex Type: A type which is made up
of other types.
Structures: a sequence of any elementary
types, reference types, or complex data types.
Internal Tables: consists of a series of lines
that all have the same data type (elementary
type, reference type, or complex data type).
Structure
* Syntax
DATA BEGIN OF <structure name>.
DATA field1.
DATA field2.
name
dob
* Include Structure
DATA BEGIN OF wa.
INCLUDE STRUCTURE customers.
DATA tel(7).
DATA END OF wa.
* Include Structure
DATA BEGIN OF Manager.
INCLUDE STRUCTURE employee.
DATA office phone(12).
DATA END OF Manager.
Defining Structure
* LIKE option
DATA Manager LIKE Employee.
Manager -id = 1.
Manager -name = John.
WRITE: Manager -id, Manager -name.
Constants
* Constant
CONSTANTS: pi TYPE p DECIMALS 2 VALUE '3.14.
CONSTANTS max_no TYPE I VALUE 999.
DATA counter TYPE I VALUE max_no.
WRITE: max_no, counter.
System Fields
The system fields (structure syst) are filled by the
runtime environment. You can use them to query the
system status in an ABAP program
You should access them only for reading
sy-datum
sy-uzeit
sy-datlo
sy-timlo
sy-mandt
sy-subrc
How to create
ABAP program
Transaction Code : SE38
1
3
1. Report Listing
4
2. Drill-down Report
3. Control-break
Report
Reading
Data
Writing
Database
Transaction : SE38
Program Attribute
ABAP Editor
Find and
Repeat Find
Syntax Check
Syntax Check
Execution (F8)
(Ctrl+F2)
Display/change mode
(Ctrl+F1)
Activation
(Ctrl+F3)
(Ctrl+Shift+F3)
Standard toolbar