We can always follow the best practise rules while dealing with abap dictionary objects. While selecting data form database tables, We have to follow the below rules :
- Do not use SELECT * from….ENDSELECT... while selecting data from any table. This acts like a loop and fetch all records. For few fields we can specifically SELECT only those fields.
- Use WHERE clause in your SELECT statement to get specific records.
- Always try to use all the primary keys of the table in the WHERE clause to get best result.
- In case all the primary keys are not available, use UP TO 1 ROWs.
- Avoid using nested SELECT statement, SELECT within Loops.
- Avoid using INTO CORRESPONDING FIELDS OF TABLE. Instead use INTO TABLE.
- Use FOR ALL ENTRIES in your SELECT statement to retrieve the matching records at one shot. And before using FOR ALL ENTRIES always check whether the table is initial or not.
- Avoid using ORDER BY in SELECT statements (instead, sort the resulting internal table), because this may add additional work to the database system which is unique, while there may be many ABAP servers.
- Avoid Executing a Select multiple times in the program. Instead of that we can create a subroutine and use that multiple times if required.
- For SELECT from multiple tables try t search for any combine VIEW, if not available then go for Inner JOIN.
- While reading data from internal tables, always sort the table and try to use BINARY SEARCH.
These are the few points we should remember while handling data dictionary.
0 comments:
Post a Comment