code pal for ABAP > Documentation > Prefer INSERT INTO TABLE to APPEND TO
This check searches for APPEND
statements and reports a finding. INSERT INTO TABLE
works with all table and key types, thus making it easier for you to refactor the table's type and key definitions if your performance requirements change.
Use INSERT INTO
instead of APPEND TO
.
In exceptional cases, you can suppress this finding by using the pseudo comment "#EC PREF_INSERT_INT
:
DATA prefer_insert_into_table TYPE TABLE OF string.
APPEND `example` TO prefer_insert_into_table. "#EC PREF_INSERT_INT
Before the check:
DATA prefer_insert_into_table TYPE TABLE OF string.
APPEND `example` TO prefer_insert_into_table.
After the check:
DATA prefer_insert_into_table TYPE TABLE OF string.
INSERT `example` INTO TABLE prefer_insert_into_table.