SAP ABAP Performance Tuning Interview Questions

10/17/2010 No Comment

What tools can be used to help with performance tuning?

ST05 is the SQL Trace transaction and can be used to measure the performance of the select statements of the program. SE30 is the Runtime Analysis transaction and can be used to measure the application performance. It also gives some tips on how to improve the performance through efficient code.

One of the best tools for static performance analyzing is Code Inspector (SCI). There are many options for finding common mistakes and possible performance bottlenecks.

What are the steps to optimise the ABAP Code?

  1. Avoid using SELECT...ENDSELECT... construct and use SELECT ... INTO TABLE.
  2. Use WHERE clause in your SELECT statement to restrict the volume of data retrieved.
  3. Use as much index fields as possible from left to right in your WHERE statement
  4. Either enable buffering in your database table or create Indexes to speed up the query.
  5. Use FOR ALL ENTRIES in your SELECT statement to retrieve the matching records at one shot.
  6. Avoid using nested SELECT statement, SELECT within LOOPs.
  7. Avoid using INTO CORRESPONDING FIELDS OF TABLE. Instead use INTO TABLE.
  8. Avoid using SELECT * and Select only the required fields from the table.
  9. Whenever using READ TABLE use BINARY SEARCH addition to speed up the search. Be sure to sort the internal table before binary search.
  10. Avoid nested loops when working with large internal tables.
  11. Use assign instead of into in LOOPs for large internal tables
  12. When in doubt call transaction SE30 and use the examples and check your code

What is the difference between SELECT SINGLE and SELECT ... UP TO 1 ROWS?

SELECT SINGLE returns the first matching row for the given condition and it may not be unique, if there are more matching rows for the given condition.

SELECT ... UP TO 1 ROWS retrieves all the matching records and applies aggregation and ordering and returns the first record.

Inorder to check for the existence of a record then it is better to use SELECT SINGLE than using SELECT ... UP TO 1 ROWS since it uses low memory and has better performance.

Which is the better - JOINS or SELECT... FOR ALL ENTRIES...?

When using FOR ALL ENTRIES the number of matching records is restricted to the number of records in the internal table. If the number of records in the database tables is too large then join would cause overheads in performance.

Some things to consider....

  1. Use "CHECK" instead of IF/ENDIF whenever possible.
  2. Use "CASE" instead of IF/ENDIF whenever possible.
  3. Use "MOVE" with individual variable/field moves instead of "MOVE-CORRESPONDING", creates more coding but is more effcient*.*
Related Posts


No comments :

 

Aired | The content is copyrighted and may not be reproduced on other websites. | Copyright © 2009-2016 | All Rights Reserved 2016

Contact Us | About Us | Privacy Policy and Disclaimer