The main important entity of abap code is internal tables. Whatever data we select form database tables, has to store in internal table first and then we process them as per clients requirement.
Internal tables are of different types. Each internal serves a particular task to improve performance of code.
1. Standard table can be accessed by Index operation, means by primary key. We should sort them by the key and use BINARY SEARCH.
2. Sorted table serves the same purpose of Standard table after applying sort.
3. Hash Table is different type of table. It can only accessed by a unique key field.
Generally while declaring an internal table we have to consider few points to optimise our code:
1. Declare a table without header line. Make the table declaration more in general. Declare work area separately to use that table.
2. While declaring a table, specify the table type as Standard/sorted/hashed.
3. Do not use INTO CORRESPONDING FIELDS, use APPEND work area to internal table.
During coding, we have to follow the below points:
1. Don't use nested loop. Try to use READ inside LOOP.
2. For specific record, you should use LOOP with WHERE clause.
3. Don't delete table entries inside a LOOP. Always flag that entry inside that LOOP or CLEAR the key field value of that table. After the LOOP delete that table where key field is SPACE.
4. Use field symbols instead of modifying any entry.
5. Check sy-subrc value after every command statement.
6. After appending always clear work area.
7. Follow the naming standards of projects.
8. Use syntax check and pretty printer.
9. If similar code need to use multiple times, It's better to create sub routine and use it multiple times.
Extended Program Check and Code Inspector check is must for every code.
Now execute. It will display all the errors. We have to creect them. Double click on each error will navigate us to that point.
Similarly for Code Inspector .
0 comments:
Post a Comment