| DO | DON’T |
| Standard and Hashed[1] internal table types. | Sorted internal table type. |
| READ on sorted standard table using ‘BINARY SEARCH’.[2] |
|
| Addition TRANSPORTING on READ and MODIFY |
|
| Parallel Cursor * TAB2 is sorted by K in ascending order | Nested Loop LOOP AT TAB1. |
| Use index operations like | WHERE clause on internal table operations e.g. |
| Mark for deletion using MODIFY in a LOOP. | DELETE WHERE in a LOOP. |
|
| MOVE-CORRESPONDING |
| Other: Table pointers for MOVE, COMPARE and mass internal table operations (itab1[] = itab2[]) Addition ASSIGNING for internal table modification and processing. Typed field symbols.[3] Pass internal tables into subroutines by reference[4] FREE internal tables | Other: SORT inside a LOOP[5] DELETE or SORT on a hashed table |
| INTERNAL TABLES MODIFY TAB FROM WA TRANSPORTING DATE WHERE DATE IS INITIAL. With the MODIFY variant MODIFY itab ... TRANSPORTING f1 f2 ... WHERE condition, the task of updating a set of lines of an internal table can be accelerated considerably. APPEND LINES OF TAB_SRC TO TAB_DEST.
DELETE TAB_DEST WHERE K = KVAL.
Check for empty table: IF TAB1[ ] is initial. * Empty internal table ENDIF.
Recommendation · Type STANDARD should be used as default type · Type HASHED if the internal table contains a large number of records and your program requires a large number of primary (unique) key accesses · Avoid using SORTED tables since the performance gain compared to a standard table is minimal, and it includes the risk that the sort sequence is corrupted by using INSERT, APPEND or MODIFY with Index option
· Key Search: READ TABLE TAB WITH KEY = . · Key/Binary Search: READ TABLE TAB WITH KEY = BINARY SEARCH. · Search with Table Index: READ TABLE TAB INDEX . The READ using the Table Index search is the fastest and the Key Search is the slowest. |
LOOP AT TAB. MODIFY TAB FROM WA TRANSPORTING DATE. ENDLOOP.
LOOP AT TAB_SRC. APPEND TAB_SRC TO TAB_DEST. ENDLOOP.
LOOP AT TAB_DEST WHERE K = KVAL. DELETE TAB_DEST. ENDLOOP. Check for empty table: DESCRIBE TABLE TAB1 LINES L1. IF L1 = 0. *Empty internal table ENDIF. |
[1] Use a hashed table whenever many single record accesses are required for an internal table via a fully specified key
[2] READ without BINARY SEARCH on a standard table forces sequential read.
[3] The runtime of a typed ASSIGN statement is around 40% less than that required for an equivalent untyped ASSIGN statement.
[4] Passing by value results in data and memory duplication.
[5] Sort is an expensive ABAP statement. It should be use outside of a loop.





