Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

read statement on dynamic internal tables

Former Member
0 Likes
989

Hello All,

I have a dynamic internal table <G_T_ITAB> with fields F1, F2, F3 & F4 .

I want to read the internal table <G_T_ITAB>. So im using the below code.

LOOP AT G_T_DATA.

READ TABLE <G_T_ITAB> INTO <G_R_ITAB> WITH KEY F1 = G_T_DATA-F1.

IF SY-SUBRC <> 0.

.......

.......

.......

ELSE.

.......

.......

.......

ENDIF.

ENDLOOP.

But this is giving syntax error that F1 is not the field of <G_T_ITAB>. But the field is there in <G_T_ITAB>.

Can you suggest me to solve this issue. Or is there any other approach to use READ statement on dynamic internal tables.

Thanks in advance.

Best Regards,

Sasidhar Reddy Matli.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
442

Hi ,

Read this way....

FIELD-SYMBOLS:

<fs_str> type any,

<fs_lf_fval> type any,

<fs_lt_result_rate> type any table,

<fs_ls_result_rate> type any.

DATA:

lv_fname type string.

lv_fname = 'MATNR'.

assign component 'matnr' of structure <fs_str> to <fs_lf_fval>.

READ TABLE <fs_lt_result_rate> INTO <fs_ls_result_rate>

WITH KEY (lv_fname) = <fs_lf_fval>.

Thanks,

Shailaja Ainala.

2 REPLIES 2
Read only

Former Member
0 Likes
443

Hi ,

Read this way....

FIELD-SYMBOLS:

<fs_str> type any,

<fs_lf_fval> type any,

<fs_lt_result_rate> type any table,

<fs_ls_result_rate> type any.

DATA:

lv_fname type string.

lv_fname = 'MATNR'.

assign component 'matnr' of structure <fs_str> to <fs_lf_fval>.

READ TABLE <fs_lt_result_rate> INTO <fs_ls_result_rate>

WITH KEY (lv_fname) = <fs_lf_fval>.

Thanks,

Shailaja Ainala.

Read only

peter_ruiz2
Active Contributor
0 Likes
442

Hi,

use this code.

READ TABLE <G_T_ITAB> ASSIGNING <G_R_ITAB> WITH KEY F1 = G_T_DATA-F1.

regards,

Peter