Skip to Content

Error in : SELECT statement with FOR ALL ENTRIES IN

Hi Guys,

I am using SELECT statement with FOR ALL ENTRIES. when I check the syntax, it is saying ENDSELECT is needed for select statement below

I verified internal table it_all_data has 5 unique records.

SELECT abkrs

FROM t549a

INTO it_t549a

FOR ALL ENTRIES IN it_all_data

WHERE abkrs EQ li_info_all-abkrs.

If I use ENDSELECT in above statement then internal table it_t540a is blank.

But this SELECT statments below works fine.

  • SELECT bukrs belnr gjahr buzei mwskz umsks prctr hkont xauto koart

  • dmbtr mwart hwbas aufnr projk shkzg kokrs

  • FROM bseg

  • INTO TABLE it_bseg

  • FOR ALL ENTRIES IN it_bkpf

  • WHERE bukrs EQ it_bkpf-bukrs AND

  • belnr EQ it_bkpf-belnr AND

  • gjahr EQ it_bkpf-gjahr.

Can somebody help to figure it out.

Thanks.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 22, 2007 at 08:44 PM

    Hi,

    Modify the code as shown below

    SELECT abkrs
    FROM t549a
    INTO <b>TABLE</b> it_t549a
    FOR ALL ENTRIES IN it_all_data
    WHERE abkrs EQ li_info_all-abkrs.
    
    
    You have to use the TABLE addition in the select statement. If you are using SELECT and ENDSELECT then there must be a APPEND statement in between the two to get the data inthe internal table.
    

    Cheers

    VJ

    Message was edited by:

    Vijayendra Rao

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 22, 2007 at 08:54 PM

    Hi

    INTO TABLE YOU HAVE TO USE AFTER DECLARING THE it_t549a internal table with abkrs FIELD

    SELECT abkrs

    FROM t549a

    INTO atble it_t549a

    FOR ALL ENTRIES IN it_all_data

    WHERE abkrs EQ li_info_all-abkrs.

    or

    SELECT abkrs

    FROM t549a

    INTO it_t549a-abkrs

    FOR ALL ENTRIES IN it_all_data

    WHERE abkrs EQ li_info_all-abkrs.

    append it_t549a.

    endselect.

    Regards

    Anji

    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.