READ TABLE for a dynamic table

Whenever you work with a dynamic table, you likely have to a READ TABLE sooner or later. But since the table is dynamic, you canโ€™t use the static field names. Luckily there is way to adress the fields dynamicly.

FIELD-SYMBOLS: <ft_proxy>   TYPE ANY TABLE,
                <fs_proxy>  TYPE any.

READ TABLE <ft_proxy>
WITH KEY ('MATNR') = <fs_predata>-matnr ('PBDNR') = <fs_predata>-pbdnr
ASSIGNING <fs_proxy>.
IF sy-subrc = 0.
    "Work with <fs_proxy>
ENDIF.

In this example we have the data with which we want to read in the field symbol <fs_predata>. What makes this work is the fact, that a strign surrounded by brackets is dynamicly transformed. Since <fs_proxy> is dynamic as well, youโ€™ll most likely want to work with ASSIGN COMPONENT to access the fields.