ABAP: 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.
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
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.