Posts

Showing posts with the label ABAP Select Queries

Optimizing ABAP Performance: Best Practices and Parallel Cursors

Image
 We have discussed the Message class and how to create a transaction code for a Executable program in our last blog. Let’s discuss some best programming practices. Best Performance Practices/Guidelines :- Never use * in the query. Fetch the data of only those columns which are required. Columns fetching sequence needs to be same as that of data dictionary column sequence. Where condition column sequence needs to be same as that of data dictionary column sequence. Never use corresponding in the query. For traditional databases avoid using JOIN, use FOR ALL ENTRIES IN. For fetching data from foreign key tables/dependent tables, Check for sy-subrc or internal table not initial condition. Use binary search in read table. Use parallel cursor in nested loops. For multiple conditions, use case conditional statement rather than if conditional statement. Depends upon the requirement, create secondary indexes to improve the performance. Never write a select query inside the loop.