SAP R/3的架构是基于三层的client/server模式
表示服务器(客户端)
应用服务器
数据库服务器
表示服务器(客户端)
表示服务器一般安装在用户的终端上,程序名为
sapgui.exe
.
表示服务器将接收用户输入,并将这些请求发送给应用服务器。应用服务器接收到请求进行处理,并将处理结果发送回表示服务器,表示服务器(
SAPGUI
)将结果格式化的输出大到用户的屏幕上。
应用服务器
应用服务器
An
application server
is a set of executables that collectively interpret the ABAP/4 programs and manage the input and output for them. When an application server is started, these executables all start at the same time. When an application server is stopped, they all shut down together. The number of processes that start up when you bring up the application server is defined in a single configuration file called the
application server profile
.
每个应用服务器都有各自的参数文件
.
例如,一个应用服务器可以配置以下参数
:
- 进程数量和进程类型
- 每个进程可用内存
- 系统自动注销的时间间隔
应用服务器将解释执行
ABAP/4
程序(
ABAP
程序不是运行在客户端)
. ABAP/4
程序是有表示服务器(客户端)启动,由应用服务器将解释并在应用服务器上执行
ABAP/4
程序(
ABAP
程序不是运行在客户端)
.
如果
ABAP/4
程序需要访问数据库,应用服务器将访问请求转化为数据语句并发送到数据库服务器
.
数据库服务器
The
database server
is a set of executables that accept database requests from the application server. These requests are passed on to the RDBMS (Relation Database Management System). The RDBMS sends the data back to the database server, which then passes the information back to the application server. The application server in turn passes that information to your ABAP/4 program.
There is usually a separate computer dedicated to house the database server, and the RDBMS may run on that computer also, or may be installed on its own computer.
配置服务器
In a three-tier client/server configuration, the presentation servers, applications servers, and database server all run on separate machines. This is the most common configuration for large systems, and is common in production.
In the distribution presentation configuration, the application and database servers are combined on one computer and the presentation servers run separately. This is used for smaller systems, and is often seen on a development system.
In the two-tier client/server configuration, the presentation and application servers are combined and the database server is separate. This configuration is used in conjunction with other application servers. It is used for a batch server when the batch is segregated from the online servers. A SAPGUI is installed on it to provide local control.
When all servers are combined onto a single machine, you have a
central
configuration. This is rarely seen because it describes a standalone R/3 system with only a single user.
定义R/3 系统
The simplest definition of an R/3 system is "
one database.
" In one R/3 system, there is only one database. To expand the definition, R/3 is considered to be all of the components attached to that one database. One R/3 system is composed of one database server accessing a single database, one or more application servers, and one or more presentation servers. By definition, it is all of the components attached to one database. If you have one database, you have one system. If you have one system, you have one database. During an implementation, there is usually one system (or one database) assigned to development, one or more systems designated for testing, and one assigned to production.
The term
R/3 system landscape
denotes a description of the number of systems within an SAP installation and how they are designated, such as development, test, or production.
定义R/3 Instance
When you hear someone say the word
instance
, most of the time, that person will be referring to an application server. The term instance is synonymous with
application server
.
The term
central instance
refers to the database server. If an application server and database server both reside on the same machine, the term
central instance
refers to the computer on which both reside.
In the most general terms,
一个实例就是一个服务器
.
它由一组为
R/3
系统提供服务的进程组成
.
应用服务器架构
所有来自客户端的请求首先发送到任务分配器
.
任务分配器首先将请求写到分配队列中。任务分配器采用先进先出的原则给每个请求分配工作进程。
每个工作进程在同一个时刻只能处理一个请求
.
为了处理用户请求,工作进程需要用户上下文和程序回滚区
.
用户上下文(User Context)
用户上下文其实是一块由
sap r/3
在用户登录时分配的内存区域,该内存区域记载了用户信息,如
:
当一个用户登录,用户上下文就会被创建。反之当用户退出系统,用户上下文就会被释放
.
用户上下文会被处理程序使用,它非常重要,具体将在下面相关章节介绍
.
回滚区(Roll Area)
回滚区是一块由工作进程为一个运行程序实例分配的内存区域。它包含了
SAP R/3
运行程序需要的信息
如:
每当用户启动一个程序,
R/3
系统就会自动为该实例创建回滚区。如果在同一时刻有两个用户运行同一个程序,系统会为每个用户创建各自的回滚区。回滚区在程序结束时释放
NOTE
|
When speaking to a Basis consultant, you might hear the term roll area used to refer to all roll areas for one user or even all roll areas on one application server. You usually can determine the intended meaning from the context in which it is used.
|
回滚区和用户上下文在
sap
的会话处理中扮演了非常重要的角色
.
会话处理( Dialog Step)
NOTE
|
会话处理是
basis
顾问测试系统响应时间的最小单位
.
|
A dialog step is the processing needed to get from one screen to the next. It includes all processing that occurs after the user issues a request, up to and including the processing needed to display the next screen. For example, when the user clicks the Enter key on the Change Vendor: Initial Screen, he initiates a dialog step and the hourglass appears, preventing further input. The
sapmf02k
program retrieves the vendor information and displays it on the Change Vendor: Address screen, and the hourglass disappears. This marks the end of the dialog step and the user is now able to make another request.
There are four ways the user can initiate a dialog step. From the SAPGUI:
- 输入回车键.
- 输入一个功能键.
- 点击屏幕的一个按钮.
- 选择一个菜单项.
It is important for an ABAP/4 programmer to know about dialog steps because they form a discrete unit of processing for an ABAP/4 program.
Understanding Roll-In/Roll-Out Processing
An ABAP/4 program only occupies a work process for one dialog step. At the beginning of the dialog step, the roll area and user context are
rolled in
to the work process. At the end of the dialog step, they are
rolled out
.
During the roll-in, pointers to the roll area and user context are populated in the work process. This enables the work process to access the data in those areas and so perform processing for that user and that program. Processing continues until the program sends a screen to the user. At that time, both areas are rolled out. Roll-out invalidates the pointers and disassociates these areas from the work process. That work process is now free to perform processing for other requests. The program is now only occupying memory, and not consuming any CPU. The user is looking at the screen that was sent, and will soon send another request.
When the next request is sent from the user to continue processing, the dispatcher allocates that request to the first available work process. It can be the same or a different work process. The user context and roll area for that program are again rolled in to the work process, and processing resumes from the point at which it was left off. Processing continues until the next screen is shown, or until the program terminates. If another screen is sent, the areas are again rolled out. When the program terminates, the roll area is freed. The user context remains allocated until the user logs off.
In a system with many users running many programs, only a few of those programs will be active in work processes at any one time. When they are not occupying a work process, they are rolled out to extended memory and only occupy RAM. This conserves CPU and enables the R/3 system to achieve high transaction throughput.
NOTE
|
ABAP/4 programs do not have the capability to intercept many common Windows events. The events that generate a lot of messages such as key presses, focus changes, and mouse movements are not passed to ABAP/4 programs. As a result, there is no way of performing some of the functions that are found in other Windows programs. For example, in ABAP/4, you cannot validate the contents of a field when the user presses the Tab key. You must instead wait until the user initiates a dialog step.
|
数据是如何和表示层服务器(客户端)交互的
在表示层服务器和应用服务器之间采用
sap
专有的信息格式进行数据传替
. SAPGUI
接收从应用服务器发送来的屏幕信息,并将根据客户端平台的进行格式化信息和显示。这样可以有多种平台同时连接同一个应用服务器。例如
, OS/2 PC
和
Windows PC
可以同时连接同一个应用服务器
.
工作进程的部件组成
每个工作进程由以下部件组成
:
- 任务处理器
- ABAP/4解释器
- 屏幕解释器
- 数据库接口
所有请求都是通过任务处理器处理,由任务处理器为请求分配处理进程
.
解释器是解释执行
ABAP/4
代码
. Sap
里有两个解释器:
ABAP/4
解释器和屏幕解释器
.
一个用来解释
ABAP/4
语言进行数据除了,另一个用来解释屏幕处理
.
每个进程都拥有自己的解释器
.
数据库接口主要负责与数据库服务器的通讯处理
.
工作进程的类型(TCODE RZ10)
Sap
中有七种类型工作进程,每种进程处理一类用户请求
.
具体类型见
Table 1.2.
Table 1.2 进程类型列表
工作进程类型
|
说明
|
D (Dialog)
|
处理会话请求
|
V (Update)
|
处理数据库更新
|
B (Background)
|
处理后台作业
|
S (Spool)
|
处理打印请求
|
E (Enqueue)
|
处理锁请求
|
M (Message)
|
处理应用服务器之间的消息
|
G (Gateway)
|
消息队列网关
|
Understanding the Logon Client
The term
logon client
has nothing to do with Client/Server-it is completely different.
The number entered here by the user corresponds to a set of rows within each client-dependent table within the database.
跨Client表
(
client-dependent)
和非跨Client表
(
client-independent)
There are two types of tables in an R/3 database:
client-dependent
and
client-independent
. A table is client-dependent if the first field is of type
CLNT
. The length will always be 3, and by convention, this field is always named
mandt
. If the first field is not of type
CLNT
, the table is client-independent.
This program selects rows from table
lfa1
and writes out
lfa1-lifnr
. When this program is run, only two rows are selected: only those where
mandt
equals
800
. This happens automatically because the first field in the table is of type
CLNT
. There are five rows in the table, but the program writes out only those rows where
mandt
equals
800
. If the user were to log on to client
700
and run the same program, three rows of data would be found and written out. If the user were to log on to client
900
, only one row of data would be found.
The logon client mechanism divides the rows within a client-dependant table into distinct groups. To access a different set of data, the user logs on and specifies a different client number.
NOTE
|
用户主数据是跨
Client
的
.
因此,
to gain access to a client, the security administrator must create a new user ID for you within that client.
|
Developers and testers use the logon client mechanism to create and access multiple, independent sets of data within a single table.
For example, assume two typical, asocial programmers are working on an enhancement to the billing system. Jim is modifying the update transaction and Jane is creating a new report to go with Jim's modifications.
Jane sets up data for her test run, executes her report and obtains output. Jim works in the next cubicle, but due to his antisocial tendencies is blissfully unaware that his transaction uses the same tables as Jane's report. He runs his transaction and updates the data. Jim got what he wanted, but Jane then modifies her code and runs her program again. Her output differs from the last run, and the differences many not result from her changes, but rather they may result from Jim's changes. What we have here is a failure to communicate.
If the tables used by Jim and Jane's programs were client-dependent, they could each log in to separate clients, set up independent sets of data, and test their programs without ever talking to each other. They could perform all of their testing in the comfort of their cubicles and in isolation from their coworkers.
To make their tables client-dependant, they only need
mandt
as the first field and the R/3 system will take care of the rest. When records are added to the table, the system automatically moves the current logon client into the
mandt
field when the record is send to the database. Their Open SQL
select
statements will only return rows where the client number in the table is equal to the their current logon client number. The Open SQL database statements
insert
,
update
,
modify
, and
delete
also provide automatic client handling.
If the tables involved are all client-dependent, there can be more than one group of testers working at a time in one test system. Two teams of testers can test divergent functionality in the same set of programs at the same time provided they log on to different logon clients. The updates done by one team will not change the data belonging to the other team.
A training client could also exist on the test system. The students could log on to one client and the testers could log on to another. Both would run the same set of programs, but the programs would access independent sets of data.
NOTE
|
一般来说
R/3
会安装三套系统
:
开发系统,测试系统和生产系统
.
默认情况,每个系统会安装三个
clients: 000, 001, and 066.
但是生产系统一般会添加一个
Client
,不会象开发系统和测试系统会从三个
clients
增加到
6
个
clients
。
|