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

For all entries

hai ..

what is the use of FOR ALL ENTRIES...

How can i take the value from diff tables into one internal table with out using JOIN... if anybody hav ex prog .. pls send Asap

How can i check the performance for my prog..

thanks and regards ..

raja..

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 27, 2006 at 07:09 AM

    Hi

    It's an option to do the select once.

    LOOP AT ITAB.

    SELECT SINGLE * FROM MARA APPENDING TABLE T_MARA

    WHERE MATNR = ITAB-MATNR.

    ENDLOOP.

    This selection is processed as many times as records are in ITAB.

    You can do once:

    SELECT SINGLE * FROM MARA INTO TABLE T_MARA

    FOR ALL ENTRIES IN ITAB

    WHERE MATNR = ITAB-MATNR.

    Max

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 27, 2006 at 07:12 AM

    you can select data from DB table for all the entries of an int table at a go using select .. for all entries.

    to select values from diff tables into an internal table, need to use join in the select statement . else create a DB view joining the DB tables and then access the view in the select statement

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 27, 2006 at 07:12 AM

    hi,

    for all entries are used to get the missing data in an internal table form appropraite database table .

    for example i_makt with fields matnr mtart spras maktx.

    and i have data in table for fields matnr and mtart and now i want to get the description for the material.

    now i will use lik

    select spras maktx from makt into table i_makt for all entries ini_makt where matnr = i_makt-matnr.

    so finally that table contains complete data.

    hope it serves ur understanding.

    nagaraju.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 27, 2006 at 07:13 AM

    Hi Rajviji,

    For all entries is other option for joins.

    i will give u an example

    select matnr mtart from mara into table it_mara

    where matnr in s_matnr.

    if not it_mara[] is initial

    select matnr werks dispo dismm from marc into table it_marc for all entries in it_mara

    where matnr = it_mara-matnr.

    endif.

    Now the above select query will fetch all the plant and other information basing on the material number.

    Regards,

    nagaraj

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 27, 2006 at 07:13 AM

    Hi rajviji,

    what is the use of FOR ALL ENTRIES

    1. INNER JOIN

    DBTAB1 <----


    > DBTAB2

    It is used to JOIN two DATABASE tables

    having some COMMON fields.

    2. Whereas

    For All Entries,

    DBTAB1 <----


    > ITAB1

    is not at all related to two DATABASE tables.

    It is related to INTERNAL table.

    3. If we want to fetch data

    from some DBTABLE1

    but we want to fetch

    for only some records

    which are contained in some internal table,

    then we use for alll entries.

    *----


    1. simple example of for all entries.

    2. NOTE THAT

    In for all entries,

    it is NOT necessary to use TWO DBTABLES.

    (as against JOIN)

    3. use this program (just copy paste)

    it will fetch data

    from T001

    FOR ONLY TWO COMPANIES (as mentioned in itab)

    4

    REPORT abc.

    DATA : BEGIN OF itab OCCURS 0,

    bukrs LIKE t001-bukrs,

    END OF itab.

    DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.

    *----


    itab-bukrs = '1000'.

    APPEND itab.

    itab-bukrs = '1100'.

    APPEND itab.

    *----


    SELECT * FROM t001

    INTO TABLE t001

    FOR ALL ENTRIES IN itab

    WHERE bukrs = itab-bukrs.

    *----


    LOOP AT t001.

    WRITE :/ t001-bukrs.

    ENDLOOP.

    regards,

    amit m.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 27, 2006 at 07:16 AM

    Hello,

    FOR ALL entries is other option to JOIN. It also increases the performance.

    But you can use thsi keyword only against a DB table and not against another internal table.

    Regs,

    Venkat

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 27, 2006 at 07:16 AM

    Hi Rajviji,

    FOR ALL ENTRIES is an effective way of doing away with using JOIN on two tables.

    You can check the below code -

    SELECT BUKRS BELNR GJAHR AUGDT

    FROM BSEG

    INTO TABLE I_BSEG

    WHERE BUKRS = ....

    SELECT BUKRS BELNR BLART BLDAT

    FROM BKPF

    INTO TABLE I_BKPF

    FOR ALL ENTRIES IN I_BSEG

    WHERE BUKRS = I_BSEG-BUKRS

    AND BELNR = I_BSEG-BELNR

    AND BLDAT IN SO_BLDAT.

    Hope this helps!

    Regards,

    Saurabh

    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.