Documente Academic
Documente Profesional
Documente Cultură
Table Of Contents
1.
2.
3.
4.
5.
6.
7.
2/ 8
3/ 8
E.g.
In case i, ABAP processer first goes to table /bic/asddwo200 and then it searches for
doc_number field and finally get its data element type. This entire procedure take bit
more time than as we do in case ii. In case ii, ABAP processor directly jumps to domain
and creates a variable of same type or of technical properties.
For internal table declaration, we must declare internal table as hashed table with unique
key if we have to select huge number of records. If number of records to be stored into
internal table is small, then we must go for standard table definition. The reason is that
read statement searches record based on key values. If internal table is not defined as
hashed table, then read statement searches internal table based on value of hashed key for
particular record, which is quite fast as performance point of view.
However, we must always take data size which is to be stored into consideration while
declaring internal table. If number of records is very small and still we are using hashed
table, it can worse the performance. Because ABAP processor spends some time in
calculation of hash keys for every record of internal table. Therefore, we must be very
careful before doing internal table declaration.
We also have to decide scope of internal table. If internal table is only used in start
routine or locally into some other routine, then we must define it locally and free it before
exiting routine. This is good practice as it frees space on ABAP stack. If the internal table
is used by many field routine, then its scope must be enhanced to global and same
internal table be re-used with in routines.
4/ 8
E.g.
In case i, deletion of records takes place one by one while in case ii, all the records that
are satisfying criteria are deleted together. So, ABAP processing is achieved quicker in
second case.
Note: One most important thing keep into consideration is to avoid use of NE
operator in DELETE or SELETE statement. This is a slow statement as it follows
only linear searching algorithm.
5/ 8
E.g.
6/ 8
C:\Documents and
Settings\Goyal2V\Desktop\sapnote_0000634263[1].pdf
ii.
iii.
iv.
Lazy practice of most ABAP programmer is to use SELECT * even when very few
fields are required. This practice slow downs extraction processes and put
unnecessary load over entire system. Application server send request to database
server to return entire structure. If return structure is very large, then it consumes lots
of CPU recourses as well as network resources. Therefore, we must avoid Select *
statement, especially when source database table have many fields. We must specify
list of fields that is we need to extract into target workarea or internal table. There are
two advantages of doing this. First, we can reduce database read time and second,
comparative less memory will be required while processing. E.g. SELECT <field1>
<field2> . INTO <workarea> / INTO TABLE <itab>.
While selecting records, we must always extract columns or fields of table in the
same order in which they are defined in table. If we extract fields in different order
than in which they are defined in table, then relining of search index takes place and it
increases read / fetch time.
Always try to restrict number of fetched records from database table by specifying
selection criteria in where clause. In start routine, we can restrict number of look-up
records based on records present in data package. So, we can use for all entries
statement with where clause. We must use as many key fields as possible with where
clause.
We can also avoid unnecessary load over database by selecting data into internal
tables instead of local variables or structures as it reduces database attempts.
E.g.
7/ 8
v.
vi.
vii.
There are many more ways to improve database access time. Careful ABAP
programming can help to reduce database read / write time.
8/ 8