Friday, June 19, 2015

SP ABAP : Performance Tuning

What tools can be used to help with performance tuning?

  1. ST05 : this is used to trace performance of the program. it trace SQL performance and mainly used to trace the performance of the select statements used in the program.
  2. SAT : used to measure the application performance. it analyse the runtime performance of the program.
  3. ST12 : this is combination of ST05 and SAT transactions.
  4. EPC (Tcode SLIN) and CI (Tcode SCI ) tools.

What are the steps to optimize the ABAP Code?

http://wiki.scn.sap.com/wiki/display/ABAP/ABAP+Performance+and+Tuning
  1. DATABASE
    1. Use WHERE clause in your SELECT statement to restrict the volume of data retrieved.  Very important !!
    2. Design your Query to Use as much index fields as possible in your WHERE statement
    3. Use INNER (or OUTER under some circumstances) JOIN in your SELECT statement to retrieve the matching records at one shot
    4. Avoid using nested SELECT statement and SELECT within LOOPs, better use JOINs or FOR ALL ENTRIES. Use FOR ALL ENTRIES when  the internal table is already there or the end of some processing. Try JOINs if the SELECT are right behind each other
    5. Avoid using INTO CORRESPONDING FIELDS OF TABLE during buffered access. Otherwise use the most appropriate for the program.
    6. Avoid using SELECT * and Select only the required fields from the table.
    7. Avoid using ORDER BY in SELECT statements if it differs from used index  (instead, sort the resulting internal table), because this may add additional work to the database system which is unique, while there may be many ABAP servers
    8. INDEX: Creation of Index for improving performance should not be taken without thought. Index speeds up the performance but at the same time adds two overheads namely; memory and insert/append performance. When INDEX is created, memory is used up for storing the index and index sizes can be quite big on large transaction tables! When inserting new entry in the table, all the index's are updated. More index more time. More the amount of data, bigger the indices, larger the time for updating all the indices
    9. Avoid Executing an identical Select (same SELECT, same parameter) multiple times in the program. Buffer in your abap code.
    10. Avoid using join statements if adequate standard views exist no performance impact
  2. TABLE BUFFER:
    1. Defining a table as buffered (SE11) can help in improving the performance but this has to be used with caution. Buffering of tables leads to data being read from the buffer rather than from table. Buffer sync with table happens periodically, only if something changes which is happen rarely. If this table is a transaction table chances are that the data is changing for a particular selection criteria, therefore application tables are usually not suited for table bufferung. Using table buffering in such cases is not recommended. Use Table Buffering for configuration data and sometimes for Master Data.. 
    2. Avoid using complex Selects on buffered tables-, because SAP may not be able to interpret this request, and may transmit the request to the database- The code inspector tells which commands bypass the buffer
  3. Internal tables
    1. Use HASHED tables where-ever possible. Otherwise SORTED tables. STANDARD tables should be the last choice.
    2. Use assign instead of into in LOOPs for table types with large work areas, if the data is being modified.
    3. When in doubt call transaction SE30/SAT and check your code.
    4. If you must use a STANDARD table and you are using a READ, sort the table appropriately and use the addition BINARY SEARCH to speed up the search. 

  4. http://wiki.scn.sap.com/wiki/display/ABAP/ABAP+Performance+and+Tuning
  5. Use SLIN and code inspector tools.











No comments:

Post a Comment