Wednesday, June 1, 2011

ABAP Fine Tuning

ABAP Fine Tuning
1   Always check the driver internal tables is not empty, while using  FOR ALL ENTRIES 
2   Avoid for all entries in JOINS 
3   Try to avoid joins and use FOR ALL ENTRIES. 
4   Try to restrict the joins to 1 level only ie only for 2 tables 
5   Avoid using Select *. 
6   Avoid having multiple Selects from the same table in the same object. 
7   Try to minimize the number of variables to save memory. 
8   The sequence of fields in 'where clause' must be as per primary/secondary index ( if any) 
9   Avoid creation of  index as far as possible 
10 Avoid operators like  <>, > , < & like % in where clause conditions 
11 Avoid select/select single statements in loops. 
12 Try to use 'binary search' in READ internal table. Ensure table is sorted before using BINARY SEARCH. 
13 Avoid using aggregate functions  (SUM, MAX etc) in selects ( GROUP BY , HAVING,) 
14 Avoid using  ORDER  BY in selects 
15 Avoid Nested Selects 
16 Avoid Nested Loops of Internal Tables 
17 Try  to  use FIELD SYMBOLS. 
18 Try to avoid into Corresponding Fields of 
19 Avoid using Select  Distinct, Use DELETE ADJACENT. 

 
A few tips you can use:

 
1. restrict the the fields retrieved by your select sentences to the minimal set. (avoid select *)
2. try to use specify where clause so the abap sql optimizer chooses the right index.
3. avoid sentences like select lifnr name1 into corresponding fields of lfa1 from lfa1 where ....
    (you should declare a working area and select into the working area, is twice faster)
4. use hashed tables instead of standard tables. They are faster.
5. Avoid the use of collect as much as you can. 


No comments:

Post a Comment