SELECT with and without for all entries giving different results

Hi All,
For some reason unknown to me ,
There is a difference in result between the below mentioned query however the logic is same.
1 .  lw_ebeln-EBELN = '0000366416'.
     APPEND lw_ebeln to lt_ebeln. 
      SELECT    ebeln
     FROM     ekbe
     INTO TABLE lt_ekbe
     FOR ALL ENTRIES IN lt_ebeln
     WHERE ebeln = lt_ebeln-ebeln
2. SELECT ebeln from ekbe into table lt_ekbe where
ebeln = '0000366416'..
I have tried a lot to find the reason but unable to.
Thanks,
Faiz

Hi faizur,
Hope it help ful.
If you add the EBELP in Internal table,  you will be getting same number of entries in both query.
For all entries Removes the Duplicate key.
Regards,
Venkat.

Similar Messages

  • SELECT ... FOR ALL ENTRIES IN fails!!!

    Hi,
    we are on Kernel 640_REL unicode and found a Kernel error:
    Using SELECT ... FOR ALL ENTRIES IN with a field list to be retrieved,  the ABAP-Database interface obviously deletes duplicate records.
    Our scenario is retrieval of open special ledger postings for customers from BSID.
    The fields specified were
    BUKRS KUNNR WAERS DMBTR WRBTR SHKZG UMSKZ
    If a customer has more than one matching record with the same amount, only one of those is returned. The only way to get all matching records is to retrieve all key fields.
    I forwarded to the people handling OSS-requests in our project. Before we get the solution, i want to issue a severe warning.
    This failure is decribed in note 65554 for Kernel-Release <= 3.0F and <= 4.6D, also Release 6.10. But nothing newer.
    After all those years of ABAP I did not expect they can't handle SQL.
    regards,
    Clemens

    Hi Clemens
    If I understand your post, I don't think there is an error, the following is from the online help:
    "The result set of the SELECT statement is the union of the individual selections for each line of the internal table. Duplicate lines are automatically eliminated from the result set. If <itab> is empty, the addition FOR ALL ENTRIES is disregarded, and all entries are read. "
    I believe that 'FOR ALL ENTRIES' is a union and therefore duplicate rows are removed.  If you want each row to appear then you need to make the row unique by using all the key fields. I think it would also be better to inlcude all the key fields in the WHERE clause anyway.
    Kind regards
    Andy

  • Regarding 'Select .... for all entries' statement

    Hi experts,
    Can anyone suggest me that whether we can use two internal tables in 'Select .... for all entries'  statement?

    Hi,
    You can use ranges instead of second for all entries.
    Eg:
    Say for example i need to write selec statement using fields from two int tables in where conidition namely itab1, itab2.
    RANGES: r_vbeln FOR wa_tab1-vbeln.
    LOOP AT itab1 INTO wa_tab1.
      r_vbeln-sign = 'I'.
      r_vbeln-option = 'EQ'.
      r_vbeln-low = wa_tab1-vbeln.
      APPEND r_vbeln.
    ENDLOOP.
    SELECT * FROM vbap INTO TABLE itab3
    FOR ALL ENTRIES IN itab2
    WHERE vbeln IN r_vbeln "range contains all vbeln from the table itab1
    AND matwa = itab2-matwa.
    Hope this helps you.
    Regards,
    Manoj Kumar P

  • Select inside loop into for all entries or joins

    Experts please help in making it into for all entries or joins.
    suppose assume this
    zuser table has 2 fields usage and kunnr.
    in i_table i always have 2 fields.
    type
    number
    type will store user or nonuser
    and number can store customer number or sales order number.
    if the type is user then the numer will be customer number and
    if the type is nonuser then the number will be sales order number.
    and values in this table is like this
    type number
    user 100001210
    nonuser 123200000
    user 124573930
    user 294839039
    user 138393903
    nonuser 382749239
    type always have user or nonuser and corresponding to them we have customer numbers.
    and now based on this we need to fine tune this code.
    parameters :p_usage(20) type char
    LOOP AT i_table.
    IF i_table-type = 'NONUSER'.
    SELECT single kunnr INTO skunnr FROM vbak WHERE
    vbeln = i_table-value.
    ENDIF.
    ENDIF.
    IF i_table-type = 'USER'.
    skunnr = i_table-value.
    ENDIF.
    IF skunnr is not initial.
    SELECT single usage FROM zuser
    INTO v_usage
    WHERE usage = p_usage
    AND kunnr = skunnr.
    IF v_usage IS NOT INITIAL.
    i_export-kunnr = i_table-type.
    i_export-auart = i_table-name.
    i_export-flag = 'X'.
    ELSE.
    i_export-NAME = i_table-type.
    i_export-age = i_table-name.
    i_export-flag = ''.
    ENDIF.
    Append i_export to itab_final.
    ENDIF.
    ENDLOOP.
    Moderator message - Moved to the correct forum
    Edited by: Rob Burbank on Jul 2, 2009 2:53 PM

    U can have this as a solution to avoid ur loop.
    declare to itabs as below:
    data: i_table_user type standard table of i_table,
            i_table_nonuser type standard table of i_table.
    i_table_user[] = i_table[].
    i_table_nonuser[] = i_table[].
    delete i_table_user where user eq 'NONUSER' .   (BY THIS YOU WILL HAVE ONLY USERS IN THIS ITAB)
    delete i_table_NONuser where user eq 'USER' . (BY THIS YOU WILL HAVE ONLY NONUSERS IN THIS ITAB)
    NOW AVOID LOOP AT ITAB AND WRITE YOUR 2 SELECT STATEMENT BY USING FOR ALL ENTRIES OF
    IF YOU DONT NEED any of THESE ITABS FURTHER , refresh them to improve ur memory and performance.
    HOPE THIS HELPS.
    THANKS
    KIRAN

  • Selecting single value using for all entries.

    Hi Experts,
    I want to know that is it possible to fetch only the first record for a particular condition while using for all entries.
    For ex:
    Suppose i got 10 different vbeln from vbak table into my internal table it_vbak. For a particular vbeln there can be multiple records in vbap table.
    Now i need to fetch only the first record which is getting from vbap table for different vbeln while using 'for all entries in it_vbak where vbeln = it_vbak-vbeln'. Is it possible?
    Thanks in Advance
    Be$t!N
    Moderator message - Moved to the correct forum
    Edited by: Rob Burbank on Nov 17, 2009 9:38 AM

    Hi Rob Burbank,
    Thanks..
    You are correct.. If that is the scenario in their company... Again it depends on the configuration and business process.. But it's possible that they may need to delete first on any line item after creation of sale order..
    In that case below solution will work..
    IF IT_VBAK[] IS NOT INITIAL.
    SELECT * FROM VBAP
    INTO TABLE IT_VBAP
    for all entries in it_vbak
    where vbeln = it_vbak-vbeln.
    ENDIF.
    SORT IT_VBAP BY VBELN POSNR.
    LOOP AT IT_VBAK INTO WA_VBAK.
    READ TABLE IT_VBAP INTO WA_VBAP WITH KEY VBELN = WA_VBAK-VBELN.
    IF SY-SUBRC = 0.
    APPEND WA_VBAP TO IT_VBAP2. " Another Internal table which stores only first record
    ENDIF.
    CLEAR : WA_VBAP.
    ENDLOOP.
    OR
    IT_VBAP3[] = IT_VBAP[].
    SORT IT_VBAP3 BY VBELN POSNR.
    DELETE ADJACENT DUPLICATES FROM IT_VBAP3 COMPARING VBELN.
    Now Table IT_VBAP2 and IT_VBAP3 will be having only first line items for all sales orders..
    Do some little changes in the code as per your requirement.
    Hope it will solve your problem..
    Thanks & Regards
    ilesh 24x7
    ilesh Nandaniya

  • Select ....FOR ALL ENTRIES.... performance tuning

    I have the following SELECT statement:
    SELECT recn, recnroot, ippers
         INTO CORRESPONDING FIELDS OF TABLE <ITAB1>
       FROM CCIHT_IP
          FOR ALL ENTRIES IN <ITAB2>
    WHERE ippers = <ITAB2>-ippers
          AND valfr LE sy-datum
          AND valto GE sy-datum
          AND iptype = 'INJ'.
    Did a trace, and the SQL executed is:
    SELECT recn, recroot, ippers
       FROM CCIHT_IP
    WHERE mandt= ?
         AND ippers IN (?1, ..., ?10)
         AND valfr <= ?
         AND valto >= ?
         AND iptype = ?
         FOR FETCH ONLY WITH UR
    This is very slow.
    To speed it up, I programmatically break up the SQL using a range table:
    i.e.:   WHERE ...
                 AND IPPERS IN <RANGE TABLE>
        With the range table containing 1500 entries which is near the limit for IN statement. This is much faster.
    The question is why with the FOR ALL ENTRIES the IN statement contains only 10 values and not the maximum allowed, is this a database config issue ?

    Hi,
    as Thomas said for this case rsdb/max_in_blocking_factor is the parameter in question.
    And yes, Andrew, you are right, FAE parameters should not be changed system wide
    since the delivered default values are those values that turned out to be the best values
    in systemwide tests.
    However you can increase the value on statement level with a hint. So you can have both
    the FAE and a non default blocking for a specific statement.
    example:
    SELECT recn, recnroot, ippers
    INTO CORRESPONDING FIELDS OF TABLE <ITAB1>
    FROM CCIHT_IP
    FOR ALL ENTRIES IN <ITAB2>
    WHERE ippers = <ITAB2>-ippers
    AND valfr LE sy-datum
    AND valto GE sy-datum
    AND iptype = 'INJ'
    %_hints db2 '&max_blocking_factor 500&&max_in_blocking_factor 500&u2019.
    Use with care.
    Kind regards,
    Hermann

  • CAN USE SELECT OPTION FIELD IN FOR ALL ENTRIES CONCEPT

    Hi sir/ madam,
    can i write code like this .
    i have data in itab1 .
    select-options : s_matnr like lips-matnr.
    SELECT VBELN VGBEL VGPOS MATNR
        FROM LIPS
        INTO TABLE I_LIPS
        FOR ALL ENTRIES IN ITAB1
        WHERE VBELN = ITAB1-VBELN AND
              MATNR = S_MATNR.
    Thanks & Regards
    Suresh kumar

    Hi Suresh,
    To correct ur code syntactically, repacle the
    =
    operator with
    IN
    . This may be correct but from data consistency point of view this may not be the ideal thing to do.
    You can foolow thw following steps:
    1. Fetch data in ITAB1 using the MATNR in the select-option. I hope you do have
    MATNR in ITAB1.
    2.
    SELECT VBELN VGBEL VGPOS MATNR
    FROM LIPS
    INTO TABLE I_LIPS
    FOR ALL ENTRIES IN ITAB1
    WHERE VBELN = ITAB1-VBELN AND
    MATNR = ITAB1-MATNR.
    This should be correct form data consistency view-point.
    Hope this answers ur query. Please award points if u find the answer helpful.
    Regards,
    Suhas

  • Joins and use FOR ALL ENTRIES

    Two questions :
    <b>(1) I use join with for all entries: the performance will go down?:</b>
    SELECT t1~MBLNR t1~MJAHR ZEILE BUDAT
    INTO TABLE gt_mseg
    FROM MSEG as T1 INNER JOIN MKPF AS T2
    ON T1~MBLNR = T2~MBLNR and
       T2~MJAHR = T2~MJAHR
    FOR ALL ENTRIES IN gt_coss
    WHERE  T1~MJAHR = gt_coss-GJAHR AND
           T1~AUFNR = gt_coss-aufnr AND
           ( BWART = '261' OR
             BWART = '262' ) AND
           T2~BUDAT IN r_budat.
    <b>(2)  With "For all entries", if itab is too long, performance will go down?. In affirmative case. What  can I do?</b>

    Hi Jose,
    You'll have to make sure your global table gt_coss isn't empty.
    A nasty little habit of the IN statement (for all entries is a kind of IN statement)
    is that when it is empty, the system selekts all records.
    You might know this when u use Select-Options in your statement (like r_budat).
    Also there is an OSS note on he for all entries (531337) problems on i-series database.
    Greetings Fred.

  • For all entries.. with agregate functions....help

    Hi ppl,
    I want to put this select query outside loop using for all entries but it doesnt support group by neither aggregate funstions like sum.
    its not giving correct results if i use collect or sum even using control break statements .
    plz help..
    LOOP AT T_UNITS.
        V_TABIX = SY-TABIX.
         get GLPCA postings
        SELECT AWTYP AWORG RACCT REFDOCNR SUM( HSL ) FROM GLPCA "1062
            INTO TABLE T_GLPCA
            WHERE RPRCTR = T_UNITS-UNIT
            AND   RACCT  IN S_HKONT
            AND   KOKRS = V_KOKRS
            AND   RYEAR = P_GJAHR
            AND   POPER  <= P_MONAT
            GROUP BY  AWTYP AWORG RACCT REFDOCNR.               "GK_166118
        SORT T_GLPCA BY AWTYP AWORG REFDOCNR.                   "1062
         process GLPCA postings
        LOOP AT T_GLPCA.
    endloop.
    some code
    endloop.
    thanks
    Archana

    ... FOR ALL ENTRIES IN itab WHERE cond
    Effect
    Only selects the records that meet the logical condition cond when each replacement symbol itab-f is replaced with the value of component f of the internal table itab for at least one line of the table. SELECT ... FOR ALL ENTRIES IN itab WHERE cond returns the union of the solution sets of all SELECT statements that would result if you wrote a separate statement for each line of the internal table replacing the symbol itab-f with the corresponding value of component f in the WHERE condition.Duplicates are discarded from the result set. If the internal table itab does not contain any entries, the system treats the statement as though there were no WHERE cond condition, and selects all records (in the current client).
    Example
    Displaying the occupancy of flights on 28.02.2001:
    TYPES: BEGIN OF ftab_type,
             carrid TYPE sflight-carrid,
             connid TYPE sflight-connid,
           END OF ftab_type.
    DATA:  ftab TYPE STANDARD TABLE OF ftab_type WITH
                     NON-UNIQUE DEFAULT KEY INITIAL SIZE 10,
           free TYPE I,
           wa_sflight TYPE sflight.
    Suppose FTAB is filled as follows:
    CARRID  CONNID
    LH      2415
    SQ      0026
    LH      0400
    SELECT * FROM sflight INTO wa_sflight
        FOR ALL ENTRIES IN ftab
        WHERE CARRID = ftab-carrid AND
              CONNID = ftab-connid AND
              fldate = '20010228'.
      free = wa_sflight-seatsocc - wa_sflight-seatsmax.
      WRITE: / wa_sflight-carrid, wa_sflight-connid, free.
    ENDSELECT.
    The statement has the same effect as:
    SELECT DISTINCT * FROM sflight INTO wa_sflight
        WHERE ( carrid = 'LH'   AND
                connid = '2415' AND
                fldate = '20010228' ) OR
              ( carrid = 'SQ'   AND
                connid = '0026' AND
                fldate = '20010228' ) OR
              ( carrid = 'LH'   AND
                connid = '0400' AND
                fldate = '20010228' ).
      free = wa_sflight-seatsocc - wa_sflight-seatsmax.
      WRITE: / wa_sflight-carrid, wa_sflight-connid, free.
    ENDSELECT.
    Notes
    You can only use ... FOR ALL ENTRIES IN itab WHERE cond in a SELECT statement.
    In the logical condition cond, the symbol itab-f is always a replacement symbol, and should not be confused with the component f of the header line of the internal table itab. The internal table itab does not need to have a header line.
    Each component of the internal table that occurs in a replacement symbol in the WHERE condition must have exactly the same type and length as the corresponding component in the database table.
    You cannot use replacement symbols in comparisons in LIKE, BETWEEN, or IN expressions.
    If you use FOR ALL ENTRIES IN itab, you cannot use ORDER BY f1 ... fn in the ORDER-BY clause.
    If you use FOR ALL ENTRIES IN itab, you cannot use a HAVING clause as well.
    Sameer

  • Inner join with for-all entries

    Why is the below inner join-for all entries does not result in expected output ?
    REPORT  ZTST3                                   .
    tables : ztst1,ztst2 .
    * table ztst1 has 4 fields : mandt,ebeln,ebelp,etenr,char4. ; ztst2 has
    * 3 fields : mandt,ebeln,ebelp,matnr
    *Entries in ztst1
    * EBELN       EBELP   ETERN  CHAR4
    * 5000000000  00010    0001    abc
    * 5000000000  00010    0002    cbd
    * 5000000000  00010    0003    efg
    *Entries in ztst2
    * EBELN       EBELP   matnr
    * 5000000000  00010    matabc
    *expected itab after inner join
    * EBELN       EBELP   CHAR4  MAtnr
    * 5000000000  00010   abc    matabc
    * 5000000000  00010   cbd    matabc
    * 5000000000  00010   efg    matabc
    data : begin of itab1 occurs 0,
           ebeln type ebeln,
           ebelp type ebelp,
           end of itab1.
    data : begin of itab occurs 0,
           ebeln type ebeln,
           ebelp type ebelp,
           char4 type char4,
           matnr type matnr,
           end of itab.
    start-of-selection.
    itab1-ebeln = '5000000000'.
    itab1-ebelp = '00010'.
    append itab1.
    select ztst1~ebeln
           ztst1~ebelp
           ztst1~char4
           ztst2~matnr into corresponding fields of table itab
    from ztst1 inner join ztst2
    on ztst1~ebeln = ztst2~ebeln and
       ztst1~ebeln = ztst2~ebelp
    for all entries in itab1
    where
    ztst1~ebeln eq itab1-ebeln and
    ztst1~ebelp eq itab1-ebelp .
    * why does it return no entries;
    break-point.

    For example in the bellow case
    *Entries in ztst1
    EBELN       EBELP   ETERN  CHAR4
    5000000000  00010    0001    abc
    5000000000  00010    0002    cbd
    5000000000  00010    0003    efg
    5000000002  00020    0003    efg
    5000000002  00020    0003    efg
    *Entries in ztst2
    EBELN       EBELP   matnr
    5000000000  00010    matabc
    5000000002  00020    abc
    may it will return you 2 records yes, than I think you have under stand the working of u201Cfor all entriesu201D ?
    And the following case I think it will work fine.
    *Entries in ztst1
    key  EBELN       EBELP   ETERN  CHAR4
    1       5000000000  00010    0001    abc
    2       5000000000  00010    0002    cbd
    3       5000000000  00010    0003    efg
    4       5000000002  00020    0003    efg
    5       5000000002  00020    0003    efg
    *Entries in ztst2
    EBELN       EBELP   matnr
    5000000000  00010    matabc
    5000000002  00020    abc
    select  ztst1~key
    ztst1~ebeln
           ztst1~ebelp
           ztst1~char4
           ztst2~matnr into corresponding fields of table itab
    from ztst1 inner join ztst2
    on ztst1~ebeln = ztst2~ebeln and
       ztst1~ebelp = ztst2~ebelp
    for all entries in itab1
    where
    ztst1~ebeln eq itab1-ebeln and
    ztst1~ebelp eq itab1-ebelp .
    Sorry, I donu2019t have system with me right now and I am sending you with out testing but I am sure that it is working the same way.
    Please Reply if any problem
    Kind Regards,
    Faisal

  • Problem with for all entries

    Hi all,
       When i was trying to use for all entries, i am not able to pull records inside my internal table. Though both of the tables have the common key fields between them(and ofcourse have entries in that). Now what i have analyzed was, the first table is having 7 primary keys and the one i am using for 'for all entries' comes 6th. Does this gives any impact in pulling records inside my internal table?.Else please give me a possible solution for this. The alternate statement(a normal select query with * ) that i had used for this reserved my dialog processor for a while. Which resulted in 'time exceeded' short dump.

    Hi,
    The WHERE clause of the SELECT statement has a special variant that allows you to derive conditions from the lines and columns of an internal table:
    SELECT ... FOR ALL ENTRIES IN <itab> WHERE <cond> ...
    <cond> may be formulated as described above. If you specify a field of the internal table <itab> as an operand in a condition, you address all lines of the internal table. The comparison is then performed for each line of the internal table. For each line, the system selects the lines from the database table that satisfy the condition. The result set of the SELECT statement is the union of the individual selections for each line of the internal table. Duplicate lines are automatically eliminated from the result set. If <itab> is empty, the addition FOR ALL ENTRIES is disregarded, and all entries are read.
    The internal table <itab> must have a structured line type, and each field that occurs in the condition <cond> must be compatible with the column of the database with which it is compared. Do not use the operators LIKE, BETWEEN, and IN in comparisons using internal table fields. You may not use the ORDER BY clause in the same SELECT statement.
    You can use the option FOR ALL ENTRIES to replace nested select loops by operations on internal tables. This can significantly improve the performance for large sets of selected data.
    Hope this is useful
    Reema

  • Select ... for all entries problem

    Hi,
    I'm making select statements to BKPF and BSEG, but I can't do an inner join between this two table because BSEG it's a cluster table so I have to do a SELECT... FOR ALL ENTRIES, but in SE16 I make the same query that I have writen in my program as shown below,
    SELECT BUKRS BELNR GJAHR BUDAT MONAT
    FROM BKPF INTO CORRESPONDING FIELDS OF TABLE it_bkpf
    WHERE  BUKRS  = 'XXX'
    AND        GJAHR  = '2005'
    AND        BELNR  = '0000000250'. "just for proof
    AND        MONAT = '10'
    The above query returns me 1 row in program and in SE16 and then I make the next query for BSEG to do the join
    SELECT BUKRS BELNR GJAHR BSCHL SHKZG WRBTR HKONT
    FROM BSEG INTO CORRESPONDING FIELDS OF TABLE IT_BSEG
    FOR ALL ENTRIES IN it_bkpf
    WHERE bukrs = it_bkpf-bukrs
    and gjahr = it_bkpf-gjahr
    and belnr = it_bkpf-belnr.
    this query returns 897 rows and in SE16 this same query returns 901 rows
    Why SELECT...FOR ALL ENTRIES brings me less rows affected by the query in SE16
    Thanks for your help!!

    Hi,
      Please use the following code for selcting the exact number of rows.
    IF it_bkpf[] IS NOT INITIAL.
      SELECT *
      FROM BSEG INTO CORRESPONDING FIELDS OF   TABLE    IT_BSEG
    FOR ALL ENTRIES IN it_bkpf
    WHERE bukrs = it_bkpf-bukrs
    and gjahr = it_bkpf-gjahr
    and belnr = it_bkpf-belnr.
    ENDIF.
    Instead of * ,you can specify the exact fields required along with all the key fields as selection fields.Also it is must to check the condition it_bkpf[] IS NOT INITIAL before using the statement FOR ALL ENTRIES IN it_bkpf.Suppose if this condition is not used and if it_bkpf is initial,it will fetch all entries from the table.
    Reward if helpful.
    Regards,
    Aravind

  • Loop -- Select, for all entries, HOW TO ?

    Hi,
    I have followoing code.
    LOOP AT table ASSIGNING  TO lt_all_roles_all_objects.
      ENDSELECT.
      ENDLOOP.
    How to tune this? I don´t understand how and where to use the for all entries command.
    And what will happen with my append?
    Can somebody explain me?
    Thanks

    Hi,
    First you need to know some of tips in abap so that you can give good shape to ur program according to performance wise.
    --Try to avoid the joins and use FOR ALL ENTRIES IN in place of joins.
    --Try to avoid the MOVE CORRESPONDING
    --Dont use the loop statements with in loop.
    -- Dont write the select statement with in loop.
    -- Better use the read statement in side loop intead of loop in side loop.
    -- Use alway BINARY SEARCH in READ statement- in this mandatory thing is u need to sorty the internal table a/c to with key conditions.
    etc.................  like this u need take care some of abap tips so that u can achieve good coding standards..
    coming to your coding.............
    declare an internal table "itab_agr_1250" which contain fields mandt, agr_name, object, and deleted .
    SELECT mandt agr_name object deleted
          from agr_1250
           into itab_agr_1250
        where agr_name = <cust_tab>-rolename
           and mandt in sp_mandt
           and deleted = ''.
    IF sy-subrc = 0.
    sort itab_agr_1250 by agr_name.
    ENDIF.
    loop at table assigning <cust_tab>.
    read table itab_agr_1250 with key agr_name = <cust_tab>-rolename
                                                                          BINARY SEARCH.
    final_Itab-field1 = itab_agr_1250-.....
    final_Itab-field2 = itab_agr_1250-.....
    final_Itab-field3 = itab_agr_1250-.....  { USE single filed assign or move statement  for each field instead of MOVE CORRESPONDING }
    append final_Itab.
    endloop.
    <b>Reward with points if useful</b>
    Regards,
    Vijay

  • What is the condition for using 'for all entries' and  why?

    what is the condition for using 'for all entries' and  why? can any body tell the reason for this ? its a big favour of me .
    regards,
    ravi.

    hi,
    for all entries is used to join two or more tables.
    It is same as join but performance wise for all entries is more effective.
    You can only use FOR ALL ENTRIES IN ...WHERE ...in a SELECT statement.
    SELECT ... FOR ALL ENTRIES IN itab WHERE cond returns the union of the solution sets of all SELECT
    statements that would result if you wrote a separate statement for each line of the internal table replacing the symbol
    itab-f with the corresponding value of component f in the WHERE condition.Duplicates are discarded from the result
    set. If the internal table itab does not contain any entries, the system treats the statement as though there were
    no WHERE cond condition, and selects all records (in the current client).
    for example:
    SELECT * FROM sflight INTO wa_sflight
    FOR ALL ENTRIES IN ftab
    WHERE CARRID = ftab-carrid AND
    CONNID = ftab-connid AND
    fldate = '20010228'.
    this condition, return all entries of the sflight
    hen using FOR ALL ENTRIES the number of matching records is restricted to the number of records in the internal table. If the number of records in the database tables is too large then join would cause overheads in performance. Additionally a JOIN bypasses the table buffering.
    So for all entries is used for filtering out the data from the two tables based on the entries in them.
    Advantages:
    1) For all entries avoids inner join & so the performance increases.
    2) For specified values in 1 itab, if you to fetch values from other table you can use it.
    3) Use of select stmt in loop is gets avoided, as u can use read statement on the the new itab.

  • 2 for all entries in a single select

    Hi all,
            I need to do 2 for all entries in a single select statement.Is there a way out?

    Hi,
    No you cant use two FOR ALL ENTRIES at a same time.
    Use either of following:-
    1. Only JOINS
    2. One JOIN and one FOR ALL ENTRIES.
    3. Use multiple queries to fill multiple internal table and then read these internal table to form a final internal table.
    Hope this solves your problem.
    Regards,
    Tarun

Maybe you are looking for

  • Cannot uninstall T-bird 24.4.0 from Win 7...shows only 48.1mb installed. I want to reload NEW T-bird.

    Was working fine, but FireFox was having trouble. I went back to Internet Explorer and all was OK until I reloaded T-bird, because I was having trouble downloading Pandora. I had to load Pandora thru a Google search. Then I lost my T-bird, so I un-in

  • Org.w3c.dom.Element

    I want to use constructor of class : com.waveset.object.WSUser.Delegate WSUser.Delegate(org.w3c.dom.Element e) i have a user object and want to pass here as argument. So can anyone tell me how to convert it into Element class object? Thanks

  • Canon 5 D image issues

    Grading a project in color that originated on the 5D. Sent to color fine (except for the issues in my previous post), then sent back to FCP and the footage has 2 issues- 1. it looks much darker than it did in color, at least 15%. 2. there are some in

  • Having trouble installing 10.5 on xserve g5

    Hello, I recently purchased an Xserve G5 from an auction site. It is a single processor 2.0ghz PPC moel with no graphics card and a CD drive and did not come with an installation CD for mac os server. Herein lies the problem... I have a Mac OSX Serve

  • WARNING: DW065: Display requirements not met for {7D4E9D10-AED6-485D-A2B0-9A1DF1A55545} Adobe Illust

    Exit Code: 6 Please see specific errors and warnings below for troubleshooting. For example,  ERROR: DF024, DW063 ... WARNING: DW065 ... -------------------------------------- Summary -------------------------------------- - 0 fatal error(s), 5 error