|
How to improve the performance of abap programs?
You can use the following points in improving the performance. Evaluate requirements Communicate with users to get actual data required so that, default values could be set on Selection Screen. This would avoid extracting whole lot of data, which may not be really needed. Match the requirements. 1. Match the alternative source of information (in less populated tables). 2. Instead of Using cluster table, find the alternative transparent tables 3. Try to match the requirements with the views. 4. Check if the logical sequence of table access is correct. It is preferable to sequence the database access to go from a table with lesser values to the more populated tables. Improve access to Tables 1. As far as possible try to have direct accesses on records by providing full key, so that access would be faster. 2. Always specify your conditions in the where-clause instead of checking them yourself with check-statements 3. Whenever possible access the tables through primary keys. Also " select single " can be very helpful. Consider the use of the DISTINCT option in the case of many duplicate entries. 4. Ensure that you utilize internal tables wherever possible. Avoid doing a large amount of processing within a database select loop. 5. Similarly nested database selects are an absolute no-no. 6. Know which Abap Statements To Be Avoided Reduce Multiple Accesses on databases 1. Avoid multiple accesses on databases. 2. Use specific fields for transferring data into the internal tables. ( use " into corresponding fields of table " flavor of the select statement ). This is especially true if less than half the available fields have to be transmitted. 3. If internal tables have many entries, a linear search through all entries is very time-consuming. Try to keep the table ordered and use binary search ( " Read table " statement with binary search ) . e.g. consider an internal table itab containing values ( 2,10,4,9,6,12,8,3). if record with val = 3 is needed the following READ statement is used READ TABLE ITAB WITH KEY VAL = 3. The read operation is done sequentially here so the required record is accessed in the 8th step. A better way to do this is : Sorting the table using : SORT ITAB. READ TABLE ITAB WITH KEY VAL = 3 BINARY SEARCH. Sorting results in : itab = ( 2,3,4,6,8,9,10,12 ) The required record is now read in the 2nd step. Note that for best results the itab must hold large number of records. 4. Avoid doing unnecessary processing within a loop. 5. A nested database select can be avoided by using the " for all entries " flavor of the select statement. A word of caution - always ensure that the table which is used for further selections (the " for all entries in table " table contains at least one record). A failure to do this check results in all records being picked up by the select. Similarly, avoid identical where clauses for different lines of ITAB by using a sorted internal table in the SELECT FOR ALL ENTRIES and using the ABAP language element DELETE ADJACENT DUPLICATES prior to executing the select statement. |
|
See Also
Get help for your ABAP problems
ABAP Books
More ABAP Tips
SAP ERP Modules, Basis, ABAP and Other IMG Stuff All the site contents are Copyright © www.erpgreat.com
and the content authors. All rights reserved.
|