2009 Apr 01 11:20 AM
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.
2009 Apr 01 11:28 AM
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.
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.
2009 Apr 01 11:28 AM
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.
2009 Apr 01 11:54 AM
Hi,
use this code.
READ TABLE <G_T_ITAB> ASSIGNING <G_R_ITAB> WITH KEY F1 = G_T_DATA-F1.
regards,
Peter
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |