Skip to Content

Checking Global Internal Table Data During Debugging

I was recently debugging a sales order user exit and wanted to see data present in all the internal tables at that point.

Since all internal tables had header line, their records count was not visible in Variable Fast Display of New Debugger.

As a result, it was inconvenient to double click on 226 internal tables only to find that most of them are empty.

This blog will cover:

  1. How to filter the internal tables’ names from a huge list of variables in New Debugger.
  2. How to easily see the record count of a given list of internal tables (esp. the ones with header line)

Scenario demonstration

A breakpoint is set in USEREXIT_READ_DOCUMENT of program MV45AFZZ and a sales order is displayed.

Navigate to Variable Fast Display > Globals tab in New Debugger.

The table icon in second column indicates that it is internal table.

We can’t know whether the table has any record by just looking at Globals tab.

To see the number of records, we need to suffix the internal table names with [].

Entering the names manually is time consuming, adding the suffix is even more time consuming.

Filtering internal tables from global variables list

We can first sort the globals list so that all internal tables are together.

There is no sort button visible, but it can be done by clicking on settings button on right side.

Select the second column, click on settings and do sort.

The sorted list now shows 20+ items at a time.

Since there were 226 internal tables, Block selection (Ctrl+Y) and PageDown cycle wasn’t so good to copy the names.

So, I used same settings button again to save the list to local spreadsheet.

We now have the list of internal tables, but they need to be suffixed with [].

Adding suffix to a list

I used Notepad++ to select every line using (.*) and regex replaced it with \1[] to add [] to all names.

However, MS Excel can also be used to do it easily using concatenation.

Just like ABAP has concatenate and && operator, MS Excel has & operator to join values.

Below screenshot shows the formula used to add suffix. Column A has the list, Column B has [].

Column C has formula =A[RowNumber]&B[RowNumber].

If I didn’t know concatenation operator, I would have pasted Column A and B to Notepad and replaced TAB character with nothing.

Variables 1 tab will be able to show records for this data.

Unfortunately “paste from clipboard” option is not present in Variables 1 tab.

The visible area allows me to display only 25 variables at once.

I copied the suffixed names in batches of 25 to see the records.

This method may seem lengthy, but it is better than double-clicking on 226 internal table names.

You must be Logged on to comment or reply to a post.
  • I was looking for a standard fix for this but this also helps. This also reminds me of sharing two such quick-fixes I've found out while recently debugging standard programs. Will share them shortly.


  • Hello Manish,

    I have been thinking about this for quite sometime and i think we can easily achieve this using debugger scripting. No need to use excel, ctrl-c, ctrl-v 🙂

    Algorithm is as follows -

    1. Read the global data of the program using cl_tpda_script_data_descr=>globals( ).
    2. Loop on table from §1 get the details of the variable using cl_tpda_script_data_descr=>factory( ). For the variables which are internal tables we can type-cast to the class CL_TPDA_SCRIPT_TABLEDESCR & use the method LINECNT( ) to get the table lines.
    3. Use the variable name from §1 & line count from §2, build an internal table.
    4. Display the internal table using cl_tpda_script_data_display=>data_display( ).

    Sample code looks something like this -

    1.   METHOD script.
    2. ****************************************************************
    4. *Importing
    6. *Returning
    8. ****************************************************************
    9.     DATA:
    10.           lwa_global_itab TYPE ty_tab_linecnt.
    11.     TRY.
    12.         LOOP AT cl_tpda_script_data_descr=>globals( ) INTO DATA(lwa_global).
    13. ****************************************************************
    15. *Importing
    17. *Returning
    19. ****************************************************************
    20.           TRY.
    21.               lwa_global_itab-lines =
    22.               CAST cl_tpda_script_tabledescr(
    23.                    cl_tpda_script_data_descr=>factory( lwa_global-name )
    24.                    )->linecnt( ).
    25.               lwa_global_itab-tabname = lwa_global-name.
    26.               APPEND lwa_global_itab TO me->global_itabs_linecnt.
    27.             CATCH ##no_handler
    28.                   cx_tpda_varname
    29.                   cx_sy_move_cast_error
    30.                   cx_tpda_data_descr_invalidated.
    31.           ENDTRY.
    32.         ENDLOOP.
    33.       CATCH cx_tpda_scr_prog .
    34.     ENDTRY.
    35.   ENDMETHOD.                    "script
    36.   METHOD end.
    37.     TRY .
    38.         cl_tpda_script_data_display=>data_display(
    39.       EXPORTING
    40.             p_popup   = abap_true
    41.           CHANGING
    42.             p_data_it = me->global_itabs_linecnt
    43.         ).
    44.       CATCH cx_tpda_table_wrong_table_type.
    45.     ENDTRY.
    46.   ENDMETHOD.                    "end

    If i find time, i'll publish a document with the detailed steps 😎



    • Hi Suhas

      It would be cool to do it within SAP GUI.

      I have not written any debugger script yet.

      About the last step, would it be possible to use double click to display the actual internal table having data? (just like forward navigation in variable display tool).