Professional Documents
Culture Documents
Shared Memory Programming With ABAP
Shared Memory Programming With ABAP
Learning Objectives
Agenda
Summary
Overall Memory
Architecture
Task 1
Task i
Task n
Process 1
Process i
Process n
Local
memory
Local
memory
Local
memory
Shared memory
Task Dispatching
Task i
Task 1
Task 1
Task 1
Task 1
Task 1
Task 1 Context i
Task i Context 1
Context 1
Context 1
Context 1
Context 1
Context 1
Context i
Process i
Process i
Process i
Process i
Process i
Process i
Process i
Process i
Process i
Process j
Shared memory
Roll
(1st try)
Extended
memory
Context i
Roll
(2nd helping)
Local
memory
(heap)
Shared
memory
(task
contexts)
Local
memory
(heap)
Table
Dictionary
buffers
buffers
Dev. obj.
Dev. obj.
buffers
buffers
Calendar
buffer
Shared memory
(transparent buffers)
OTR
buffer
Shared
memory
(task
contexts)
Roll
(1st try)
Extended
memory
Shared
memory
Context i
Roll
(2nd helping)
EXP/IMP
Shared
Memory
Local
memory
(heap)
Shared
Objects
Memory
Table
buffers
Table
Dictionary
buffers
buffers
Dev. obj.
Program
buffers
buffer
(prog. etc.)
Calendar
buffer
Shared memory
(transparent buffers)
OTR
buffer
ST02
Dictionary
buffers
Dev. obj.
buffers
Calendar &
OTR buffer
Table
buffers
EXP/IMP
buffers
Memory
settings
Dictionary
buffers
Table
buffers
Dev.
Table
obj.
buffers
Calendar
buffer
Memory
settings
OTR
buffer
EXP/IMP
Buffers
buffers
Efficiency
Size
Directory
entries
Swaps
Resets
abap/
buffersize
abap/
pxa
Maximum
Dynamically
switchable?
Same on all
servers?
Default value
Profile value
Current value
Type pools
%_C*
Generated
basis programs
/1BC*/*
Some other
programs
Global classes
CL_*
Version
20:52:35
Text Pool
Version
20:55:57
Version
20:56:39
Efficiency
Size
Directory
entries
Swaps
Resets
rsdb/obj/
buffersize
rsdb/obj/
max_objects
rsdb/obj/
large_obj_size
rsdb/obj/
mutex_n
Maximum
Dynamically
switchable?
Same on all
servers?
Default value
Profile value
Current value
Exercises Chapter 1
1. What are the system's current memory settings ?
2. How are the EXPORT/IMPORT buffers configured ?
3. What is the advantage of using shared memory instead of
process local memory for task/transaction contexts ?
4. What is the advantage of still using paging for EXPORT TO
MEMORY ?
Fully buffered
All country information is
buffered
When using more advanced SELECT variants, the buffer will be silently
bypassed in many cases
DISTINCT
aggregate functions COUNT, SUM, AVG, MIN, MAX
GROUP BY, HAVING
joins, subqueries
IS NULL
ORDER BY (<> PRIMARY KEY)
BYPASSING BUFFER
Exercises Chapter 2
1. Is client table t000 buffered ? If yes, how ?
2. When should you specify "Buffering not allowed" for a database
table ?
EXPORT/IMPORT
TO/FROM
Different Media
Persistent memory:
DATABASE
DATASET (obsolete)
Exercises Chapter 3
1. Export some data structure containing object and/or data
references to shared buffer. Use the following framework:
* ...
CALL TRANSFORMATION id SOURCE item = src RESULT XML xmlstr.
EXPORT ser FROM xmlstr TO SHARED BUFFER ...
* ...
IMPORT ser TO xmlstr FROM SHARED BUFFER ...
CALL TRANSFORMATION id SOURCE XML xmlstr RESULT item = dest.
* ...
IF equal( op1 = src op2 = dest ) <> abap_true.
* ...
ENDIF.
ENDCLASS.
"node DEFINITION
items,
items,
TYPE items
TYPE items
TYPE abap_bool.
"test DEFINITION
*---------------------------------------------------------------------*
*
CLASS test IMPLEMENTATION
*---------------------------------------------------------------------*
CLASS test IMPLEMENTATION.
"fill_items
"display_items
*---------------------------------------------------------------------*
*
METHOD equal_items
*---------------------------------------------------------------------*
METHOD equal_items.
DATA: lines1
lines2
ref1
ref2
TYPE
TYPE
TYPE
TYPE
i,
i,
REF TO item,
REF TO item.
equal = abap_false.
"equal_items
*---------------------------------------------------------------------*
*
METHOD main
*---------------------------------------------------------------------*
METHOD main.
DATA: items1
items2
xmlstr
id
TYPE
TYPE
TYPE
TYPE
items,
items,
string,
indx-srtfd VALUE 'items_id'.
*
*
(3) Serialize data containing data and object references into its canonical
XML representation
CALL TRANSFORMATION id SOURCE items = items1 RESULT XML xmlstr.
*
*
(6) Deserialize data containing data and object references from its
canonical XML representation
CALL TRANSFORMATION id SOURCE XML xmlstr RESULT items = items2.
ENDCLASS.
"main
"test IMPLEMENTATION
*---------------------------------------------------------------------*
*
START-OF-SELECTION
*---------------------------------------------------------------------*
START-OF-SELECTION.
test=>main( ).
Classes
CL_ABAP_EXPIMP_* for
Administrating EXP/IMP
Media
cl_abap_expimp_mem
+get_next_level(id generic_key)
->level_tab
+get_keys(id generic_key)->keytab
+get_directory(id)->directory
+delete(id generic_key)
+delete_all()
cl_abap_expimp_shmem
cl_abap_expimp_shbuf
cl_abap_expimp_db
cl_abap_expimp_shmem
cl_abap_expimp_shbuf
cl_abap_expimp_db
CL_ABAP_EXPIMP_* - Functionality
Administration is especially important for SHARED MEMORY, because
there is no automatic displacement of items that are buffered in
SHARED MEMORY !
get_next_level(): return next key level (tables, clients, areas, or ids) for
a given partial sequential key
generic_key: flag, indicating that trailing blanks in the last key field
supplied are to be replaced by pattern '*'
"main DEFINITION
"client_dependent
METHOD display_keys.
DATA: shbuf
TYPE REF TO cl_abap_expimp_shbuf,
keytab_c TYPE TABLE OF expimp_key_c,
entries TYPE i.
"display_keys
"main IMPLEMENTATION
"cl_items_wrapper DEFINITION
"cl_items_wrapper IMPLEMENTATION
Without compression
EXPORT
IMPORT
With compression
EXPORT
IMPORT
Pure itab
Buffered DB-Tab
Data Buffer
Internal Table
Memory
Shared Memory
Shared Buffer
Database
----464
553
501
855
868
95,631
----13,498
13,520
13,660
13,594
13,521
32,913
135
470
508
503
557
817
827
18,335
Input size:
102,400
103,088
18,858
----2,486
2,461
2,430
2,461
2,453
7,386
Pure itab
Buffered DB-Tab
Data Buffer
Internal Table
Memory
Shared Memory
Shared Buffer
Database
Without compression
EXPORT
IMPORT
----7,260
7,878
7,353
13,191
13,148
2,528,886
5,190
5,974
7,895
7,919
7,845
13,832
13,991
173,071
With compression
EXPORT
IMPORT
----139,524
138,015
140,245
138,402
138,257
357,992
----25,019
25,008
24,909
25,621
25,432
57,046
Input size:
1,030,088
186,553
For each id, load data only once from shared memory into the
context of a task/transaction (i.e. load only once per id into the 'roll
area')
buffer accessed items in a private static attribute
items_admin_tab
Exercises Chapter 4
1. Write a class that encapsulates a shared-buffer-based ressource
identified by some id. Provide methods for
getting items out of the buffer,
reading the keys (= ids) of the items currently stored in the buffer,
deleting items in the buffer.
*
*
*---------------------------------------------------------------------*
*
CLASS items_wrapper DEFINITION
*---------------------------------------------------------------------*
* Encapsulated buffered access to some items via get_item_ref( )
*---------------------------------------------------------------------*
CLASS items_wrapper DEFINITION.
PUBLIC SECTION.
*
Line type of internal table used for managing context-local (i.e. roll area
specific) versions of buffered items
TYPES: BEGIN OF item_admin,
key TYPE item_key,
ref TYPE REF TO item,
END OF item_admin.
ENDCLASS.
"items_wrapper DEFINITION
*---------------------------------------------------------------------*
*
CLASS items_wrapper IMPLEMENTATION
*---------------------------------------------------------------------*
CLASS items_wrapper IMPLEMENTATION.
ENDMETHOD.
"fill_item
*---------------------------------------------------------------------*
*
METHOD get_item_ref
*---------------------------------------------------------------------*
* Public method providing buffered access to some items identified by
* some key
*---------------------------------------------------------------------*
METHOD get_item_ref.
DATA: admin TYPE item_admin,
cx
TYPE REF TO cx_sy_export_buffer_no_memory.
*
*
*
*
*
*
*
ENDCLASS.
"get_item_ref
"items_wrapper IMPLEMENTATION
*---------------------------------------------------------------------*
*
CLASS test DEFINITION
*---------------------------------------------------------------------*
CLASS test DEFINITION.
"test DEFINITION
*---------------------------------------------------------------------*
*
CLASS test IMPLEMENTATION
*---------------------------------------------------------------------*
CLASS test IMPLEMENTATION.
*---------------------------------------------------------------------*
*
METHOD show_items
*---------------------------------------------------------------------*
METHOD show_items.
DATA: shbuf TYPE REF TO cl_abap_expimp_shbuf,
keys TYPE TABLE OF expimp_c_key,
dir
TYPE TABLE OF cdir.
"show_items
'INDX'
'XK'
<key>-id
dir ).
TYPE
TYPE
TYPE
TYPE
TYPE
REF TO item,
LINE OF item,
i,
i,
i VALUE 80.
"access_item
"access_items
*---------------------------------------------------------------------*
*
METHOD delete_items
*---------------------------------------------------------------------*
METHOD delete_items.
DATA: shbuf TYPE REF TO cl_abap_expimp_shbuf.
show_items( ).
CREATE OBJECT shbuf.
shbuf->delete( tabname = 'INDX' area = 'XK' ).
ENDMETHOD.
"delete_items
"main
"test IMPLEMENTATION
*---------------------------------------------------------------------*
*
START-OF-SELECTION
*---------------------------------------------------------------------*
START-OF-SELECTION.
test=>main( ).
Shared Objects:
Sneak Preview
bound to top level task/transaction within a user session, i.e. "up to /n"
(analogous to EXPORT TO MEMORY)
Summary
Questions?
Q&A
Feedback
Some software products marketed by SAP AG and its distributors contain proprietary software components of other
software vendors.
Microsoft, WINDOWS, NT, EXCEL, Word, PowerPoint and SQL Server are registered trademarks of
Microsoft Corporation.
IBM, DB2, DB2 Universal Database, OS/2, Parallel Sysplex, MVS/ESA, AIX, S/390, AS/400, OS/390,
OS/400, iSeries, pSeries, xSeries, zSeries, z/OS, AFP, Intelligent Miner, WebSphere, Netfinity, Tivoli,
Informix and Informix Dynamic ServerTM are trademarks of IBM Corporation in USA and/or other countries.
HTML, DHTML, XML, XHTML are trademarks or registered trademarks of W3C, World Wide Web Consortium,
Massachusetts Institute of Technology.
MarketSet and Enterprise Buyer are jointly owned trademarks of SAP AG and Commerce One.
SAP, SAP Logo, R/2, R/3, mySAP, mySAP.com and other SAP products and services mentioned herein as well as
their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other
countries all over the world. All other product and service names mentioned are trademarks of their respective
companies.
Die von SAP AG oder deren Vertriebsfirmen angebotenen Softwareprodukte knnen Softwarekomponenten auch
anderer Softwarehersteller enthalten.
Microsoft, WINDOWS, NT, EXCEL, Word, PowerPoint und SQL Server sind eingetragene Marken der
Microsoft Corporation.
IBM, DB2, DB2 Universal Database, OS/2, Parallel Sysplex, MVS/ESA, AIX, S/390, AS/400, OS/390,
OS/400, iSeries, pSeries, xSeries, zSeries, z/OS, AFP, Intelligent Miner, WebSphere, Netfinity, Tivoli, Informix
und Informix Dynamic ServerTM sind Marken der IBM Corporation in den USA und/oder anderen Lndern.
HTML, DHTML, XML, XHTML sind Marken oder eingetragene Marken des W3C, World Wide Web Consortium,
Massachusetts Institute of Technology.
MarketSet und Enterprise Buyer sind gemeinsame Marken von SAP AG und Commerce One.
SAP, SAP Logo, R/2, R/3, mySAP, mySAP.com und weitere im Text erwhnte SAP-Produkte und -Dienst-leistungen
sowie die entsprechenden Logos sind Marken oder eingetragene Marken der SAP AG in Deutschland und anderen
Lndern weltweit. Alle anderen Namen von Produkten und Dienstleistungen sind Marken der jeweiligen Firmen.