Professional Documents
Culture Documents
1
SAP Development Community of Experts
4
SAP Development Community of Experts
5
SAP Development Community of Experts
Process
Process
Process
Process
Process
OS
OS
OS
OS
OS
Programs running
in the background
connect to a Work
Process for the
Background
Background
entire runtime of
Process
Process
Process
Process
Process
Dialog
Dialog
Dialog
the program. If no Database
process is
available then the
job is put into a
waiting status
Foreground
programs attach
to work processes
only when they
Foreground Programs
Session
Session
Session
Session
Session
Session
Session
Program
Program
Background Jobs
require processing
ABAP
ABAP
Active
their sessions
when waiting for
user input)
Program
Program
Program
Program
Program
Program
Program
Program
Program
ABAP
ABAP
ABAP
ABAP
ABAP
ABAP
ABAP
ABAP
ABAP
8
SAP Development Community of Experts
SQL - Insert
Commit Work
SQL - Insert
Message Statement
SQL - Insert
Rollback Work
SQL - Insert
End of program
11
SAP Development Community of Experts
13
SAP Development Community of Experts
Form f_Message
Using else.
l_ID l_Number l_Type l_Text l_Var1 l_Var2 l_Var3 IF ( NOT l_ShowMessage is initial ).
l_Var4. Message l_text
Type l_Type.
Data:
else.
l_Message type string,
l_ShowMessage(1) type c.
l_Message = l_Text.
endif.
clear l_ShowMessage. endif.
clear l_Message. if ( not l_Message is initial ).
write:/ l_ID, l_Number, l_Type, ' - ', l_Message.
if ( ( l_Type = 'E' or l_Type = 'X' ) or endif.
( NOT sy-batch IS INITIAL ) ). EndForm.
l_ShowMessage = 'X'.
endif.
if ( l_Text is initial ).
IF ( NOT l_ShowMessage is initial ).
Message ID l_ID This routine can be used for the outputting
Type l_Type
Number l_Number of messages appropriately for the
With l_Var1
l_Var2 foreground and background. Besides
l_Var3
l_Var4. ensuring that an implicit commit isnt
else.
Message ID l_ID triggered it also prevents you from having
Type l_Type
Number l_Number
to hit enter through all of your logging
With l_Var1
l_Var2
messages
l_Var3
l_Var4
Into l_Message.
endif.
14
SAP Development Community of Experts
Process 1
Select record
Update record
Select record
Select record
Commit Work
Process 2
Select record
Select record
17
SAP Development Community of Experts
Implicit Commits
Explicit Commit
SAP
Process
Database
If you go to transaction
SM50 and view the
available work processes,
you will notice a number of
processes with types UPD
and UP2, these are update
tasks processes.
On execution of an explicit
Commit Work statement the
update task is triggered to
DIA - Dialog start processing
Work asynchronously while the
Process calling program continues
Start of program
Update Task"
Call function A using In
Update Task
Call function B using In
Update Task
Call function A using In
Executed
Explicit Commit Work
..
..
..
..
UPD -
Update All functions that have been
Work put onto the update task
Process
Functions called using In queue are executed as a
Function A is executed
Function B is executed
Function A is executed
Executed
Explicit Commit Work
Update Task have their input single transaction in the order
parameters stored in the that they were requested
update task queue for
postponed processing
21
SAP Development Community of Experts
On execution of an explicit
Commit Work And Wait
statement the update task is
triggered to start processing
asynchronously and the
DIA - Dialog calling program waits for the
Work
Process
V1 update task to complete
before continuing processing
Start of program
Update Task"
Call function A using In
Update Task
Call function B using In
Update Task
Call function A using In
..
..
..
..
UPD -
Update All functions that have been
Work put onto the update task
Process
Functions called using In queue are executed as a
Function A is executed
Function B is executed
Function A is executed
Executed
Explicit Commit Work
Update Task have their input single transaction in the order
parameters stored in the that they were requested
update task queue for
postponed processing
22
SAP Development Community of Experts
23
SAP Development Community of Experts
SQL - Insert
update task
Call BAPI that calls an
SQL - Insert
Update Task
Call function B using In
There is an implicit
commit at the end of the
program but no explicit
commit has been put in
24
SAP Development Community of Experts
25
SAP Development Community of Experts
$4 + $1 + $10 = $15
User 3 Something is wrong!
(5) Check Balance: $14
Were missing $1 in
the balance! 27
SAP Development Community of Experts
User 1 User 2
$4 + $1 + $10 = $15
User 3 The balance is
(13) Check Balance: $15 correct!
28
SAP Development Community of Experts
29
SAP Development Community of Experts
Process 1 Process 2
1
Select for update on record A 2 Process 2
Select for update on record A doesnt
3
Update record A complete the
4 select on record
Commit Work A until the lock
5
is released by
Select for update on record A
process 1
6
Update record A
7
Commit Work
30
SAP Development Community of Experts
X
until
process 2 6 to
is killed Select for update on record B detection
(which 7 of a
releases Update record A & B Update record A deadlock
8
the lock) Commit Work Commit Work
31
SAP Development Community of Experts
33
SAP Development Community of Experts
Enqueue Modes
(s) Shared lock
Several users (transactions) can access locked data at
the same time in display mode. Requests from further
shared locks are accepted, even if they are from different
users. An exclusive lock set on an object that already has
a shared lock will be rejected.
(E) Exclusive
An exclusive lock protects the locked object against all
types of locks from other transactions. Only the same
lock owner can reset the lock (accumulate).
(X) Exclusive non-cumulative
Whereas exclusive locks can be requested several times
by the same transaction and released one by one, an
exclusive, non-cumulative lock can only be requested
once by the same transaction. Each further lock request
will be rejected.
34
SAP Development Community of Experts
Process 2
S
A exclusive lock
Process 3
can not be obtained
on a record if there
E are currently
shared locks on it
35
SAP Development Community of Experts
Exclusive locks on a
record can be accumulated
within the same process
Process 1
E E
An exclusive lock
Process 2
can not be obtained
A shared lock on a record if there
can not be E are currently
obtained if there exclusive locks on
are currently it
shared Process 3
exclusive locks S
on it
36
SAP Development Community of Experts
Exclusive locks on a
record can not be
accumulated within the
same process if it has been
locked as exclusive non-
Process 1 cumulative
X E
A exclusive lock
Process 2
can not be obtained
on a record if there
E are currently
excusive locks on it
37
SAP Development Community of Experts
Existing lock
Same process
(E) Exclusive
Requested Lock
Same process
(X) Exclusive Non-
Cumulative
Different process
(S) Shared
Different process
(E) Exclusive
Different process
(X) Exclusive Non-
Cumulative
38
SAP Development Community of Experts
39
SAP Development Community of Experts
Release Lock
Release Lock
1 1
3 3A
DIA - Dialog
Work
Process
2
Release Lock
3B UPD -
Update
Work
2 Process
40
SAP Development Community of Experts
41
SAP Development Community of Experts
Execute on Execute on
Customer group Data Customer group
Z01 Z02
42
SAP Development Community of Experts
Worker
Data
Driver
43
SAP Development Community of Experts
Enqueue Server
44
SAP Development Community of Experts
45
SAP Development Community of Experts
Questions
46