Working with Internal Tables
追加数据
APPEND
APPEND statement always adds the record at the end of the table and is used with standard tables.
You need to use caution when using an APPEND statement with sorted tables; the system may produce a runtime error if the new row does not match the sort sequence of the table or if the table is defined with a unique key and the new row creates a duplicate entry
Recommend always using the INSERT statement with sorted tables.
Can't use APPEND statements with hashed tables, because they only support INSERT statements.
To add a record to an internal table, first fill the work area with the required data and then append it to the table using the APPEND statement.
INSERT
INSERT statement behaves like an APPEND statement for standard tables in that it adds a record at the end of the table if no explicit index is speci fied
With sorted tables, the INSERT statement automatically selects the position based on the sort sequence of the table.
When an index is supplied with the INSERT statement, the record is added explicitly in that row. If the index supplied is greater than the line of the table, no record is inserted and the system field sy-subrc is set to 4.
Last updated