Contents:: Program Flow in An ABAP Program

Download as pdf or txt
Download as pdf or txt
You are on page 1of 27

Program Flow in an ABAP Program

Contents:
 Client / server architecture
 Sample program with data displayed in list form
 Sample program with data displayed on a screen
 Which ABAP program components are discussed in
which units?

 SAP AG 1999

(C) SAP AG BC400 2-1


Overview

Client
Client // server
server architecture
architecture

Sample
Sample program
program with
with data
data displayed
displayed in
in list
list form
form

Sample
Sample program
program with
with data
data displayed
displayed on
on the
the screen
screen

Which
Which ABAP
ABAP program
program components
components are
are discussed
discussed
in
in which
which units?
units?

 SAP AG 1999

(C) SAP AG BC400 2-2


 The R/3 System has a modular software architecture that follows software-oriented client/server
principles.
 The R/3 System allocates presentation, applications, and data storage to different computers. This serves
as the basis for the scalability of the R/3 system.
 The lowest level is the database level. Here data is managed with the help of a relational database
management system (RDBMS). In addition to master data and transaction data, programs and the
metadata that describe the R/3 System are stored and managed here.
 ABAP programs run at the application level, both the applications provided by SAP and the ones you
develop yourself. ABAP programs work with data called up from the database level and store new data
there as well.
 The third level is the presentation level (SAPGUI). This level contains the user interface, in which an
end user can access an application, enter new data and receive the results of a work process.
 The technical distribution of software is independent of its physical location on the hardware. Vertically,
all levels can be installed on top of each other on one computer or each level on a separate computer.
Horizontally, application and presentation level components can be divided among any number of
computers. The horizontal distribution of database components, however, depends on the type of
database installed.

(C) SAP AG BC400 2-3


 This graphic can be simplified for most topics discussed during this course. The interaction between
ABAP programs and their users will be of primary interest to us during this course. The exact processes
involved in user dispatching on an application server are secondary to understanding how to write an
ABAP program. Therefore we will be working with a simplified graphic that does not explicitly show
the dispatcher and the work process. Certain slides will, however, be enhanced to include these details
whenever they are relevant to ABAP programming.
 ABAP programs are processed on the application server. The design of the user dialogs and the
database dialogs is therefore of particular importance when writing application programs.

(C) SAP AG BC400 2-4


 The user is primarily interested in how his or her business transaction flows and in how data can be input
into and displayed from the transaction. Technical details, such as whether a single program is running
or multiple programs are called implicitly, or the technical differences between the kind of screens being
displayed, are usually less important to the user. The user does not need to know the precise flow of the
ABAP program on the application server. Users see the R/3 System with application servers and
database as a black box.
 There are, however, three technically distinct screen types (screens, selection screens, and lists) that offer
the user different services. It is the developer's job to determine which type of user dialog is most
suitable to the user's needs.

(C) SAP AG BC400 2-5


 When the user performs a user action (choosing Enter, a function key, a menu function or a pushbutton,
for example), control is handed over from the presentation server to the application server and certain
parts of the ABAP program are processed. If further user dialog is triggered within the ABAP program,
the system sends a screen to the presentation server and control is once again handed over to the
presentation server.

(C) SAP AG BC400 2-6


Overview

Client
Client // server
server architecture
architecture

Sample
Sample program
program with
with data
data displayed
displayed in
in list
list form
form

Sample
Sample program
program with
with data
data displayed
displayed on
on the
the screen
screen

Which
Which ABAP
ABAP program
program components
components are
are discussed
discussed
in
in which
which units?
units?

 SAP AG 1999

 In this part of the unit, the user has chosen to start a program where an airline ID can be entered on the
initial selection screen. The program subsequently uses this information to retrieve the 'Long name of
airline' and the 'Local currency of airline' from the database and display them for the user in list form.

(C) SAP AG BC400 2-7


 Whenever a user logs on to the system, a screen is displayed. From this screen, the user can start a
program by using its menu path.

(C) SAP AG BC400 2-8


 If the user has triggered a program with a user action, then the program context is loaded on the
application server. The program context contains memory areas for variables and complex data objects,
information on the screens for user dialogs and ABAP processing blocks. The runtime system gets the
program information from the Repository, which is a special part of the database.
 The sample program has a selection screen as the user dialog, a variable and a structure as data objects
and one ABAP processing block. The list that is used to display the data is created dynamically at
runtime.
 The subsequent flow of the program is controlled by the ABAP runtime system.

(C) SAP AG BC400 2-9


 Since the program contains a selection screen, the ABAP runtime system sends it to the presentation
server at the beginning of program processing. The presentation server controls the program flow for as
long as the user fills in the input fields.
 Selection screens allow users to enter selection criteria required by the program.

(C) SAP AG BC400 2-10


 As soon as the user has finished entering data on the selection screen, he or she can trigger further
processing by choosing 'Execute'. All data input on the selection screen is the automatically placed in its
corresponding data object in the program and the ABAP runtime system resumes control of processing.
Our sample program contains only one ABAP processing block. The runtime system triggers sequential
processing of this ABAP processing block.
 If the entries made by the user do not have the correct type, then an error message is automatically
triggered. The user must correct his/her entries.

(C) SAP AG BC400 2-11


 The ABAP processing block contains a read access to the database that has been programmed into it.
The program also passes the database information about which database table to access and which line in
the table to read.

(C) SAP AG BC400 2-12


 The database returns the requested data record to the program and the runtime system ensures that this
data is stored in the appropriate data objects. Normally a structure is the target field when a single record
is accessed. The structure contains variables for all fields requested from the database.

(C) SAP AG BC400 2-13


 The layout of the subsequent list display has also been programmed into the processing block. After all
processing has ended, the runtime system sends the list screen to the presentation server.

(C) SAP AG BC400 2-14


Overview

Client
Client // server
server architecture
architecture

Sample
Sample program
program with
with data
data displayed
displayed in
in list
list form
form

Sample
Sample program
program with
with data
data displayed
displayed on
on the
the screen
screen

Which
Which ABAP
ABAP program
program components
components are
are discussed
discussed
in
in which
which units?
units?

 SAP AG 1999

 In this part of the unit, the user starts a second sample program where an airline ID can be entered on the
initial selection screen. This program subsequently uses the information input on the selection screen to
retrieve the 'Long name of airline' and the 'Local currency of airline' from the database and display them
for the user on a screen.

(C) SAP AG BC400 2-15


 When the user starts the program, the program context is loaded first. This time, however, our sample
program contains three processing blocks, a selection screen, and a screen, and a variable and two
structures as its data objects.

(C) SAP AG BC400 2-16


 Since the program contains a selection screen, the ABAP runtime system sends it to the presentation
server at the beginning of program processing.

(C) SAP AG BC400 2-17


 As soon as the user has finished entering data on the selection screen, he or she can trigger further
processing by choosing 'Execute'. All data input on the selection screen is then automatically placed in
its corresponding data object in the program and the ABAP runtime system resumes control of
processing. The runtime system then triggers sequential processing of the ABAP processing block that
comes after the selection screen.

(C) SAP AG BC400 2-18


 The ABAP processing block contains a read access to the database that has been programmed into it.
The program also passes the database information about which database table to access and which line in
the table to read.

(C) SAP AG BC400 2-19


 The database returns the requested data record to the program and the runtime system ensures that this
data is stored in the appropriate data objects. Normally a structure is the target field when a single record
is accessed. The structure contains variables for all fields requested from the database.

(C) SAP AG BC400 2-20


 The ABAP processing block now triggers screen processing. This is often expressed simply by saying
'The program calls the screen'. However, in reality, each screen possesses its own processing block that
is sequentially processed before the runtime system sends the screen to the presentation server (Process
Before Output). This allows screens to be used in a very flexible manner.

(C) SAP AG BC400 2-21


 After the screen's processing block has been processed, the ABAP runtime system sends the screen to
the presentation server. During this process, data is transported into the screen's fields from a structure
that serves as an interface for the screen.

(C) SAP AG BC400 2-22


 Once the user performs a user action (choosing Enter, a function key, a menu function or a pushbutton,
for example), control is handed over to the runtime system on the application server again. The screen
fields are transported into the structure that serves as the screen's interface and a special processing block
belonging to the screen is triggered. This processing block is always processed immediately following a
user action (Process After Input).

(C) SAP AG BC400 2-23


 After the 'Process After Input' processing block has been processed, the sample program continues
processing the ABAP processing block that called the screen in the first place.

(C) SAP AG BC400 2-24


Overview

Client
Client // server
server architecture
architecture

Sample
Sample program
program with
with data
data displayed
displayed in
in list
list form
form

Sample
Sample program
program with
with data
data displayed
displayed on
on the
the screen
screen

Which
Which ABAP
ABAP program
program components
components are
are discussed
discussed
in
in which
which units?
units?

 SAP AG 1999

(C) SAP AG BC400 2-25


Course Content

Unit 1 Introduction
Unit 2 Program Flow in an ABAP Program
Unit 3 Introduction to the ABAP Workbench
Unit 4 ABAP Statements and Data Declarations
Unit 5 Database Dialogs I (Reading Database Tables)
Unit 6 Internal Program Modularization
Unit 7 User Dialogs: List
Unit 8 User Dialogs: Selection Screen
Unit 9 User Dialogs: Screen
Unit 10 Interfaces

 SAP AG 1999

(C) SAP AG BC400 2-26


Course Content

Unit 11 Reuse Components


Unit 12 Database Dialogs II (Making Changes to the Database)
Unit 13 Software Logistics and Software Adjustment

Exercises
Solutions
Appendices

 SAP AG 1999

(C) SAP AG BC400 2-27

You might also like