In the past,
APPEND TO was my go-to for adding new entries to an Internal Table (itab).
Revisiting my coding style, I will use
INSERT from now on.
INSERT INTO TABLE instead
In general, the
INSERT statement expresses the intention better. After all, the goal is to insert entries into the table and not appending them.
INSERT VALUE #( ... ) INTO TABLE itab.
INSERT ... INTO TABLE works with all table types. It does not matter if a table is declared as
When requirements change you can focus on optimizing table key types. The
INSERT statements will still work fine.
APPEND TO is the right choice
APPEND TO if you want to stress that this entry should be the last row. For example when an itab is used in an array-like fashion.
APPEND TO only works (safely) for itabs defined as