ABAP Keyword Documentation →  ABAP Programming Guidelines →  Robust ABAP →  Internal Tables → 

Collected Filling

Background

The statement COLLECT can be used to collect rows and insert them in an internal table. If a row with the relevant primary key already exists in the target table, the values of numeric components are added to the values in the existing table row. Otherwise, a new row is inserted in the table.

Rule

Do not fill standard tables with collections of rows

Only use the statement COLLECT for hashed tables or sorted tables with a unique key. Do not use it any more for standard tables.

Details

The statement COLLECT is based on unique entries with respect to the primary key and stable key administration. This means that not all categories of internal ables are suitable for COLLECT: