ABAP New Debugger has also got few new features as part of release 7.0 EhP2. A new addition “Key” in Table Display Tool is added to check various keys available on the Internal Table.
Key in Table Tool
When you navigate to the Table Display tool in the New Debugger by double clicking on any table, you would have a new option called Key. In this drop-down field, you would notice all the available keys for the internal table.
For example, check out this code.
TYPES: tt_t100 TYPE STANDARD TABLE OF t100 WITH KEY sprsl arbgb msgnr " Primary Key WITH NON-UNIQUE SORTED KEY lang_text " Secondary Key COMPONENTS sprsl text. * DATA: t_t100 TYPE tt_t100.
For this internal table, you would notice two keys – PRIMARY_KEY and LANG_TEXT (Secondary Key). As of 7.0 EhP2, as I have noted in ABAP Internal Table Secondary Keys, New in ABAP 7.0 EhP2, we’ll have a default key name as PRIMARY_KEY. Since I have declared a secondary key for my table, it is available in the options as well.
You would also notice a small Key ICON next the attributes. This option allows you to check all the Keys and its fields.
Secondary Key behavior
When you select the Secondary Key, system would display the contents of the table based on the key definition. Secondary Key is a Sorted key on SPRSL and TEXT fields in this example, thus table T_T100 is sorted based on the those two fields.
TIP: Key fields are also highlighted in a different color. If you have noticed in here, Key fields SPRSL and TEXT are colored in Blue color vs normal field content in Black color.
Outdated Secondary key
If the table contents are changed and update on Secondary Key is not yet executed by system, the content of the Secondary key is outdated. When you try to navigate or view the contents of the table by Secondary key, system would produce a message with outdated contents.
Since in this case, Lazy Update would take place Only when the table got first accessed (check Program from ABAP Internal Table Secondary Key Performance comparison). So, if you try to see the content of T_T100 using the secondary key, it produce an error message as shown below.
These new additions to the New Debugger removes the guess work on how the table would be accessed as well as if the Secondary Key is up-to-date or not.
You must leverage Secondary Key on ITAB as well as these features in New Debugger, it makes life easier