Professional Documents
Culture Documents
ABAP Best Performance Guidelines
ABAP Best Performance Guidelines
ABAP Best Performance Guidelines
Purpose:
- To familiarize ABAP developers with best performance guidelines for writing ABAP code.
Scope:
- Include several points highlighting the pros and cons of different syntax and coding
methods.
- Assist ABAP developers in enhancing code efficiency.
Benefits:
SUSHANT SINGH 0
Introduction:
In computer science, there are many ways to solve a problem using
different methods.
It's important to compare these methods to see which one works best.
- We want algorithms that run quickly, so our apps don't slow down.
- E.g. How we can remove all the wanted data declaration and use best
practice instead of hard coding.
SUSHANT SINGH 1
- CORRESPONDING USE BELOW:
- Below is structure declaration
- Now, with this syntax it will not throw error, but lowers the performance.
- SAP will go to the field-by-field mapping with Corresponding.
- Without its SAP will go by default sequence wise (Best Performance).
SUSHANT SINGH 2
For all entries – Load to only one table (We write individual queries)
- Below here at a time load to only one db. table:
SUSHANT SINGH 3
- In case of HANA DB (HDB) we can easily work with joins.
Note: It will fetch all the data from for all entries dependent table,
which is wrong:
----------------------------------------------------------------------------------------------
SUSHANT SINGH 4
- Searching and Sorting concepts comes under DSA (Data
structure and algorithms)
SUSHANT SINGH 5
2. Enhance it with parallel cursor: only 8 times
Note Below:
Sy-tabix: Return current iteration of the current loop.
I – Integer – Complete data type – No need to specify the length.
SUSHANT SINGH 6
- Always fetch the data one time and then apply loop or read table
to the output.
SUSHANT SINGH 7
Index in SAP: Used to directly points to the record
Primary Index: Created automatically by Primary key in the table.
Secondary Index: We can create
SUSHANT SINGH 8
- Below, Order no. is the Primary key, and we are fetching based on
it: It is good practice:
Here, below, order date is not Primary key, and it is our requirement, it
will affect performance.
SUSHANT SINGH 9
➔ Always Check for Secondary Index first, if provided by SAP.
➔ Check whether there is need for secondary index as it increases
space complexity.
Happy Learning
SUSHANT SINGH 10