ABAP For Power Users E&S
ABAP For Power Users E&S
Copyright
No part of this publication may be reproduced or transmitted in any form or for any purpose
without the express permission of SAP AG. The information contained herein may be
changed without prior notice.
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.
ORACLE is a registered trademark of ORACLE Corporation.
UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.
Citrix, the Citrix logo, ICA, Program Neighborhood, MetaFrame, WinFrame,
VideoFrame, MultiWin and other Citrix product names referenced herein are trademarks
of Citrix Systems, Inc.
HTML, DHTML, XML, XHTML are trademarks or registered trademarks of W3C, World
Wide Web Consortium, Massachusetts Institute of Technology.
JAVA is a registered trademark of Sun Microsystems, Inc.
JAVASCRIPT is a registered trademark of Sun Microsystems, Inc., used under license for
technology invented and implemented by Netscape.
MarketSet and Enterprise Buyer are jointly owned trademarks of SAP Markets 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.
Contents
Exercise description: Performance Analysis of Internal Tables ......................................... 4
Exercise Tasks: Performance Analysis of Internal Tables ................................................. 4
Source Example: Performance Analysis of Internal Tables ............................................... 5
Exercise description: Internal Table List Writer.................................................................. 7
Exercise Tasks: Internal Table List Writer ......................................................................... 7
Source Example: Internal Table List Writer ....................................................................... 8
Exercise description: Database List Writer ........................................................................ 9
Exercise Tasks: Database List Writer ................................................................................ 9
Source Example: Database List Writer ............................................................................ 10
Exercise description: Performance of Generating Programs ........................................... 11
Exercise Tasks: Performance of Generating Programs ................................................... 11
Source Example: Performance of Generating Programs ................................................. 12
Task 2:
Define a STANDARD, SORTED and HASHED TABLE with line type Integer and the key
TABLE_LINE.
Task 3:
Fill the three tables using three DO loops with the number of entries specified by the
PARAMETER. Calculate the run time of all three loops and write the result devided by the
count of entries to the ABAP list for every table.
Task 4:
Now use a DO loop to READ WITH KEY each entry of the three tables and calculate the
run time for every table.
Task 5:
At the end, use a DO loop to READ with INDEX each entry of the standard and sorted table
and calculate the run time.
TIP: Use GET RUN TIME FIELD to get run time.
Use SY-INDEX to fill and read the tables.
SY_INDEX contains the actual loop count within DO and ENDDO.
i, t2
TABLE
TABLE
TABLE
TYPE
OF i
OF i
OF i
i, t
WITH
WITH
WITH
TYPE p DECIMALS 2,
NON-UNIQUE KEY table_line,
UNIQUE KEY
table_line,
UNIQUE KEY
table_line.
Task 2
Define and fill an internal table with a line type of your choice to test the form
WRITE_TABLE.
TIP: Use LOOP ASSIGNING nested with ASSIGN COMPONENT compindex OF
STRUCTURE and DO loop to access each field of every line.
TIP: If you need more information about the syntax and the semantics of an ABAP
statement use Online-Help by pressing F1 and entering the first word of the statement.
Task 2
Use the CREATE DATA statement to create an appropriate internal table as a destination
for a SELECT on the database table.
Task 3
Use the OpenSQL SELECT together with Dynamic Token Specification for the FROM and
WHERE clause.
Task 4
At the end, take the form WRITE_TABLE from Exercise: Generic Internal Table List
Writer to write the result of the SELECT to the ABAP list.
Task 2
Define a PARAMETER for a counter with default value 100.
Task 3
Perform the form and submit the program counter times and calculate the runtime for one
SUBMIT and one PERFORM IN PROGRAM.
TIP: Use GET RUN TIME FIELD to get relative runtime (see Exercise: Performance
Analysis of Internal Tables).