Ansicht
Dokumentation

ABENITAB_KEY_DUPLICATES - ITAB KEY DUPLICATES

ABENITAB_KEY_DUPLICATES - ITAB KEY DUPLICATES

CPI1466 during Backup   General Data in Customer Master  
This documentation is copyright by SAP AG.
SAP E-Book

- Duplicate Unique Keys

When lines are inserted into internal tables with a unique primary key or unique secondary key, duplicates can occur with respect to one or more of these keys. Depending on whether the insertion is a single record operation or a mass operation, the ABAP runtime framework reacts as follows to an attempt to insert an entry with duplicate key values:

  • First, it checks whether duplicate key values would occur with respect to the primary key. The system behavior is as follows depending on the operation:
  • When single lines are inserted using the variant

INSERT wa INTO TABLE itab
duplicate entries with respect to the primary key are ignored and sy-subrc is set to 4. This is often used to filter out duplicates when the table is constructed.
  • In all other cases, such as

INSERT ... INTO itab INDEX idx
INSERT LINES OF (bulk operation)
APPEND
COLLECT
=, IMPORT (bulk operations)
the runtime error ITAB_DUPLICATE_KEY occurs.
  • A check is then made to see whether duplicate key values would occur with respect to any existing unique secondary keys. If this is the case,

  • For all other insert and assignment operations, particularly for all mass operations, the runtime error ITAB_DUPLICATE_KEY occurs.

The first INSERT statement does not insert a line and sets sy-subrc to the value 4. The second INSERT statement produces a runtime error.






Fill RESBD Structure from EBP Component Structure   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.

Length: 2717 Date: 20240419 Time: 043332     sap01-206 ( 37 ms )