This tip is excerpted from Matt Wong's SAP Basis site.
ABAP/4 programs can take a very long time to execute, and can make other processes have to wait before executing. Here are some tips to speed up your programs and reduce the load your programs put on the system:
- Use the GET RUN TIME command to help evaluate performance. It's hard to know whether that optimization technique REALLY helps unless you test it out. Using this tool can help you know what is effective, under what kinds of conditions. The GET RUN TIME has problems under multiple CPUs, so you should use it to test small pieces of your program, rather than the whole program.
- Generally, try to reduce I/O first, then memory, then CPU activity. I/O operations that read/write to hard disk are always the most expensive operations. Memory, if not controlled, may have to be written to swap space on the hard disk, which therefore increases your I/O read/writes to disk. CPU activity can be reduced by careful program design, and by using commands such as SUM (SQL) and COLLECT (ABAP/4).
- Avoid 'SELECT *', especially in tables that have a lot of fields. Use SELECT A B C INTO instead, so that fields are only read if they are used. This can make a very big difference.
- Field-groups can be useful for multi-level sorting and displaying. However, they write their data to the system's paging space, rather than to memory (internal tables use memory). For this reason, field-groups are only appropriate for processing large lists (e.g. over 50,000 records). If you have large lists, you should work with the systems administrator to decide the maximum amount of RAM your program should use, and from that, calculate how much space your lists will use. Then you can decide whether to write the data to memory or swap space. See the Fieldgroups ABAP example.
- Use as many table keys as possible in the WHERE part of your select statements.
Did you like this tip? If so (or if not) let us know. Send an email to sound off. Or go to our tips page and rate this, and other, tips, or send us one of your own.
Java & BAPI Technology for SAP
Author: Ken Kroes, Gareth M. deBruyn, Robert Lyfareff, Anil Thakur
Publisher: Prima Publishing
Cover type: Hard Cover
Published: June 2000
Learn from Experts Who Know
Draw from the authors' years of experience with SAP implementations. Follow along and learn how platform-independent Java can reduce both development and on-going maintenance costs for custom software. Learn how to integrate Java with SAP, as well as the basics of integrating the SAP Automation toolkit to develop applets or Java applications.
Master the Skills You Need Most
Begin with Java basics and learn the role Java plays in the ERP industry. Next, move on to integrating Java with SAP. Benefit from practical examples that allow you to see how Java and SAP can be used together. Finally, continue on to BAPIs: what they are, how to find them within SAP, and how to build your own custom BAPIs.
Apply Real-World Scenarios
Follow along and benefit from the book's extensive collection of screen images and code examples. Use the step-by-step examples to reproduce results and understand the concepts discussed in this introduction to Java programming within SAP.