Ansicht
Dokumentation

ABENITAB_KEY_SECONDARY_UPDATE - ITAB KEY SECONDARY UPDATE

ABENITAB_KEY_SECONDARY_UPDATE - ITAB KEY SECONDARY UPDATE

Addresses (Business Address Services)   TXBHW - Original Tax Base Amount in Local Currency  
This documentation is copyright by SAP AG.
SAP E-Book

- Updating Secondary Table Keys

For all statements that change the content and structure of an internal table, the internal administration of the secondary keys is updated automatically as follows:

  • For all operations that insert lines into tables or delete lines from tables, the secondary key administration for unique keys is updated immediately, that is, a unique secondary key is up-to-date immediately after the operation (direct update). Non-unique secondary table keys are not updated immediately and only when the secondary key is next used explicitly using USING KEY or WITH KEY ... COMPONENTS (lazy update). If an update violates secondary key uniqueness, a catchable exception or runtime error occurs.
Inserting operations include table statements such as INSERT and APPEND and block operations in which the entire body of the table is filled at once, like for statements between internal tables, passing parameters to procedures, filling internal tables with SELECT, importing with IMPORT, and so on. The operation for deleting table lines is the table statement DELETE.
  • For operations that change the components of secondary table keys in existing lines, the secondary key administration is either updated directly or only at a specified synchronization time.
  • If MODIFY is used to modify individual lines, any unique secondary keys are updated directly (direct update). If the modification produces duplicate entries, an uncatchable exception is raised.

  • If field symbols or data references that point to table lines are used to modify individual lines, any unique secondary keys are updated the next time the internal table is accessed (delayed update). The uniqueness check also only takes place at the time of synchronization. An internal table can therefore be in an inconsistent state with respect to the secondary key following a modification to existing lines using field symbols or data references. The corresponding exception is only raised when the table is next used.

In both cases, a non-unique key not updated until the secondary table key is next used explicitly (lazy update).

The methods FLUSH_ITAB_KEY and FLUSH_ITAB_KEYS of the class CL_ABAP_ITAB_UTILITIES can be used to update individual secondary keys or all secondary keys of an internal table explicitly in exceptional circumstances. These methods can be used for analysis and test purposes. It might also make sense to use them after making changes if the next access does not take place immediately afterwards to handle possible exceptions there and then.

The example for Deletion Using Table Keys demonstrates the runtimes that are required to create the secondary key and when they occur.






RFUMSV00 - Advance Return for Tax on Sales/Purchases   General Data in Customer Master  
This documentation is copyright by SAP AG.

Length: 4096 Date: 20240328 Time: 171827     sap01-206 ( 73 ms )