Skip to Content
author's profile photo Former Member
Former Member

read statement on dynamic internal tables

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Apr 01, 2009 at 10: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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 01, 2009 at 10:54 AM

    Hi,

    use this code.

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

    regards,

    Peter

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.