How to remember the syntax of INSERT, APPEND in SAP ABAP

  1. When inserting records in to an Internal table using ‘INSERT’ command, please write explicitly in the query INTO TABLE ‘Internal table’
    • Example : SELECT contact_id contact_name contact_address FROM ztt_db_table1 INTO TABLE lt_internal_table
  2. When inserting record using APPEND, then it is always used with TO ‘Internal_table’
    • Example: APPEND ls_contact_details TO lt_internal_table
  3. When ‘INDEX’ is used to insert the record at a particular position of the table, then please don’t mention INTO TABLE.
    • INSERT LINES OF lt_internal_table1 INTO lt_internal_table2 INDEX 2.
  4. Index works only at a position where record exists (n) and at a position which is equal to n+1. Here n is the number of records. As shown in below table, the records exists at the index position 1,2 and 3.
IndexRecord nameWorks ( yes or no )
1Record 1 yes
2Record 2 yes
3Record 3 yes
4yes
5No