0% found this document useful (0 votes)
15 views11 pages

ABAP Best Performance Guidelines

This document contains some of the best performance guidelines for ABAPers
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views11 pages

ABAP Best Performance Guidelines

This document contains some of the best performance guidelines for ABAPers
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

ABAP BEST PERFORMANCE

AUTHOR: SUSHANT SINGH CHHATRYA (11066)

SAP BRF+ CONSULTANT

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:

- Learn Best practices of ABAP.


- Understand the fundamentals of space and time complexity.

JULY 22, 2024


INVENIOLSI

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.

- Time complexity: tells us how fast an algorithm runs as the input


size grows.

- We want algorithms that run quickly, so our apps don't slow down.

- E.g. As ABAPer, how we can enhance our loops to minimise


execution time.

- Space complexity: tells us how much memory an algorithm need.

- We aim to use memory efficiently to avoid running out of space on


our systems.

- E.g. How we can remove all the wanted data declaration and use best
practice instead of hard coding.

ABAP: Best performance Guidelines:

SUSHANT SINGH 1
- CORRESPONDING USE BELOW:
- Below is structure declaration

- Now below is the select query will changed sequence

- 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).

Traditional DB: Oracle, DB2, Sybase. (Cannot handle large data)

In Join – Load to multiple tables in a database

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:

- Goto -> System -> Status -> Check DB

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:

- Below lt_data is empty, and we have not check it.


- Leads to fetch full data.
- Wrong o/p.

----------------------------------------------------------------------------------------------

- Always remember to SORT the table first cause binary search


work on sorted tables.
- Please refer to Searching algorithms for more information.

SUSHANT SINGH 4
- Searching and Sorting concepts comes under DSA (Data
structure and algorithms)

- Header table: LT_DATA


- Item table: LT_DATA1.

1. Nested Loops: Looping 8*8*8 times = 64 times

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.

- Work for Index: 1, 4, 6


- Whenever order no. is not matching, we exit from the loop, in that way we save our
iterations.

SUSHANT SINGH 6
- Always fetch the data one time and then apply loop or read table
to the output.

If: Checks all the conditions one by one, Less performance.

Case: It will directly jump to the condition.

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

- Below is screenshot to check and create index:

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.

Note: On creating Secondary index, it will store as a separate


repository in database table:
So, it occupies space on the DB!

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

You might also like