Sie sind auf Seite 1von 13

ABAP Course

Chapter 6 Specialities for


ERP software
Lecturer: Andr Bgelsack, UCC Technische Universitt Mnchen
Author: Valentin Nicolescu, Andr Bgelsack
ABAP Course

Andr Bgelsack, Valentin Nicolescu

Copyright 2008 UCC TU Mnchen


All rights reserved

Weitergabe und Vervielfltigung dieser Publikation oder von Teilen daraus sind, zu welchem Zweck und in
welcher Form auch immer, ohne die ausdrckliche schriftliche Genehmigung durch HCC TU Mnchen nicht
gestattet. In dieser Publikation enthaltene Informationen knnen ohne vorherige Ankndigung gendert werden.

Microsoft, WINDOWS, NT, EXCEL, Word, PowerPoint und SQL Server sind eingetragene Marken der
Microsoft Corporation.

IBM, DB2, OS/2, DB2/6000, Parallel Sysplex, MVS/ESA, RS/6000, AIX, S/390, AS/400,
OS/390 und OS/400 sind eingetragene Marken der IBM Corporation.

ORACLE ist eine eingetragene Marke der ORACLE Corporation.

INFORMIX-OnLine for SAP und Informix Dynamic ServerTM sind eingetragene Marken der Informix Software
Incorporated.

UNIX, X/Open, OSF/1 und Motif sind eingetragene Marken der Open Group.

Citrix, das Citrix-Logo, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, MultiWin
und andere hier erwhnte Namen von Citrix-Produkten sind Marken von Citrix Systems, Inc.

HTML, DHTML, XML, XHTML sind Marken oder eingetragene Marken des W3C, World Wide Web Consortium,
Massachusetts Institute of Technology.

JAVA ist eine eingetragene Marke der Sun Microsystems, Inc.

JAVASCRIPT ist eine eingetragene Marke der Sun Microsystems, Inc., verwendet unter der Lizenz der von
Netscape entwickelten und implementierten Technologie.

SAP, SAP Logo, R/2, RIVA, R/3, SAP ArchiveLink, SAP Business Workflow, WebFlow, SAP EarlyWatch, BAPI,
SAPPHIRE, Management Cockpit, mySAP, mySAP.com und weitere im Text erwhnte SAP-Produkte und
-Dienstleistungen sowie die entsprechenden Logos sind Marken oder eingetragene Marken der SAP AG in
Deutschland und anderen Lndern weltweit. MarketSet und Enterprise Buyer sind gemeinsame Marken von SAP
Markets und Commerce One.

Alle anderen Namen von Produkten und Dienstleistungen sind Marken der jeweiligen Firmen.

Die Verwendung der Screenshots wurde mit dem jeweiligen Eigner abgesprochen.

ABAP Course

Andr Bgelsack, Valentin Nicolescu

Agenda
1.
2.
3.
4.

Authorizations
Lock objects
Logical units of work
Updater

ABAP Course

Andr Bgelsack, Valentin Nicolescu

Authorizations
Before starting a program user authorizations should always be
checked
But: authorizations are not checked by the system
Every ABAP program has to check authorizations by itself
Different authorization levels: READ (01), CHANGE (02),
DELETE (03) for every data set
Transaction: SU03

ABAP Course

Andr Bgelsack, Valentin Nicolescu

Locking concept
What happens when several users want to work on the same
data set? data inconsistency
Lock objects prevent simultaneous changes on data set
Beside the lock concept of the database, SAP implements its
own lock concept
SAP does not use the databases lock concept
Deadlock:
May occur when two programs wait for each other to lock data
set
Rare

ABAP Course

Andr Bgelsack, Valentin Nicolescu

Locking concept
Modes:
1. Read lock = shared lock
Locks data set for reading
Several shared locks may exist on one data set at the
same time
Prevents the SAP system from creating an exclusive lock
on a data set
2. Write lock = exclusive lock
Locks data set for writing/changing
No shared locks, only one is allowed at the same time
First come, first serve

ABAP Course

Andr Bgelsack, Valentin Nicolescu

Locking concept
Creation of a lock object:
Creation can be done in data
dictionary (SE11)
One lock object per database table
Lock objects are generated
automatically by using the
primary key
There is only one lock object
dealing with all lock modes

ABAP Course

Andr Bgelsack, Valentin Nicolescu

Usage of lock objects


Two function modules are generated automatically when creating
a lock object:
Enqueue_<lock object> lock data set
Dequeue_<lock object> unlock data set
Before writing/reading data set lock data set
After writing/reading data set unlock data set
In case of an error unlock data set
Use button PATTERN to avoid misspellings
Locks can be viewed and deleted in transaction SM12

ABAP Course

Andr Bgelsack, Valentin Nicolescu

Generation of lock objects


Lock object
EZ_SPFLI

Activate

Function

Function

ENQUEUE_ESFLIGHT

DEQUEUE_ESFLIGHT

Lock data set

ABAP Course

Unlock data set

Andr Bgelsack, Valentin Nicolescu

ENQUEUE parameters
Parameter

Value

Meaning

mode_<tabname
>

S
X

Read lock (shared)


Exclusive lock (not shared)

<lock parameter> <value>

Field values used to lock the data set

_wait

SPACE
X

If foreign lock, no new attempt


If foreign lock, new attempt

_collect

SPACE
X

Lock without local lock container


Lock with local lock container

ABAP Course

Andr Bgelsack, Valentin Nicolescu

10

Logical unit of work (LUW)


Logical unit of work (transaction)
breakdown
Process
before
output
(PBO) 100

Process
after input
(PAI) 100

Commit

Dynpro
100
User input

Scenario:
Scenario:

What
Whathappens
happensififaabreakdown
breakdownofofthe
the
SAP
system
occurs
in
the
middle
of
SAP system occurs in the middle ofthe
the
transaction?
What
happens
to
the
data?
transaction? What happens to the data?

ABAP Course

Process
before
output
(PBO) 200

Process
after input
(PAI) 200

Dynpro
200
User input

Andr Bgelsack, Valentin Nicolescu

11

Logical unit of work (LUW)

Problem:
New data sets are transferred into the database
by each screen
Only if last screen of the program is reached and
all data sets are written to the database the data
are correct
Solution
Updates to database are written to the updater
process
Only when last screen of the program is reached,
the updater receives a trigger to write data to
database (commit) or to dismiss (rollback)
ensures data integrity
ABAP Course

Andr Bgelsack, Valentin Nicolescu

12

Logical unit of work (LUW)

Schema:

Protocoll table
Data
Data
Data

Data

Data
deletes

Work process
Program
Lock data set

Work process
Updater
4
Database

ABAP Course

Andr Bgelsack, Valentin Nicolescu

13