ABAP programming has a number of tools which are provided to improve the performance of a program. For example: SQL Trace (ST05), Tips and Tricks tool, the performance database and The runtime analysis (SE30). The runtime analysis transaction is used to see the analysis of a program with respect to the database and for non database processing. SQL trace transactions can be viewed to see the number of related programs which were used for execution of a program and one can restrict the number of programs by using statements such as filter.
Some of the SAP ABAP performance tuning tips and tricks are given below
1. Use WHERE clause for every select statement to restrict large data. Select DISTICNT for unit data. Use ORDER BY/GROUP BY/HAVING Clause to search for records, Use JOINS. In case of ORDER BY Clause SELECT DISTINCT should not be used instead, ABAP SORT + Delete ADJACENT DUPICATES can be used.
2. To further restrict the amount of data one can use FOR ALL. FOR ALL can be used in case the OUTER JOIN is used because it speeds up the performance but one should be careful in using FOR ALL on table where the IN clause data is very large. "FOR ALL" can reduce the performance if the IN clause takes in large data.
3. Using selection criteria restrict the amount of data taken out from the database. Therefore, selection criteria should be used for each query.
4. The tables should have indexes, as it sorts the data and eases search.
5. Instead of looping through a number of records, one can go for a key to get multiple accesses.
6. One can use transactions either through the transaction code or use the menus role based menus, user specific menus or use system defined menus to look into the transactions.
7. Instead of using the MOVE CORRESPONDING clause one can use MOVE statements for all the headers of the internal tables in one time.
8. Moving a table - field by field is not appropriate, instead, use a where clause which is based on the index of the table.
9. In case of multiple tables use the JOIN statement to read data and use INNER JOIN to reduce the load.
10. Instead of taking data through the base table, use VIEWS to search for the data, because the data provided in views are taken from many tables and it is limited.
11. Instead of taking one data at one time from another table - select all data in one go .Use query "Select * from Tablename1 into Tablename2" to get the desired result.
12. Binary search reduces the search interval and the search process can be narrowed by using binary search. For example
Instead of using
READ Table T1 with key A1 = 'RT'.
READ Table T1 with key A1 = 'RT' binary search.
13. Instead of using ORDER BY one can use the ABAP SORT because the statement ABAP SORT is executed on the application server and the order by clause is executed on the server.