| ABAP Fine Tuning
Do anyone have any tips on how to fine tune an ABAP program or report?
I am doing fine tuning on the PM module for some reports.
Conrad Chia
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.
To clarify the following doubts:
1. Suppose if we are in 3rd list and want to jump to 8th list,
how is it possible?
You can try SY-LSIND.
2. What exactly the statement "select for all entries" mean?
You can only use FOR ALL ENTRIES IN ...WHERE ...in
a SELECT statement.
SELECT ... FOR ALL ENTRIES IN itab WHERE cond returns
the union of the solution sets of all SELECT
statements that would result if you wrote a separate
statement for each line of the internal table replacing the symbol
itab-f with the corresponding value of component
f in the WHERE condition.Duplicates are discarded from the result
set. If the internal table itab does not contain
any entries, the system treats the statement as though there were
no WHERE cond condition, and selects all records
(in the current client).
for example:
SELECT * FROM sflight INTO wa_sflight
FOR ALL ENTRIES IN ftab
WHERE CARRID = ftab-carrid AND
CONNID = ftab-connid AND
fldate = '20010228'.
this condition, return all entries of the sflight
3. Is it possible to create a table without the data element?
Yes, there is option of direct type in se11.
4. Suppose in selection screen if we provide two values for the fields
then how to populate the other fields?
You can go for select option, there you can choose
low and high values.
5. How to send the sap-script in pdf format thru email?
It is automatically converted to PDF once the Basis
people have the auto conversion rules configured.
6. How many selection-screens does a report have?
Any number of selction screen can be there
Rashi Agnihotri
You haven't provided us with many information about your problem.
Anyway 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.
Horacio
Fast Links:
Get help for your ABAP problems
Do you have a ABAP Question?
ABAP Books
ABAP Certification,
BAPI, Java, Web Programming, Smart Forms, Sapscripts Reference Books
Best regards,
SAP Basis, ABAP Programming and Other IMG Stuff
http://www.sap-img.com
All the site contents are Copyright © www.sap-img.com
and the content authors. All rights reserved.
All product names are trademarks of their respective
companies. The site www.sap-img.com is in no way affiliated with
SAP AG.
Every effort is made to ensure the content integrity.
Information used on this site is at your own risk.
The content on this site may not be reproduced
or redistributed without the express written permission of
www.sap-img.com or the content authors.
|