Select query 'for all entries'

Hello Friends,
       SELECT emp_id emp_name
       INTO corresponding fields of table itab_emp
       FROM employee
       for all entries in itab_dept
       WHERE emp_id = itab_dept_emp_id.
In the above select query we are using 'for all entries' for the internal table itab_dept.What will happen if the join fails?Will we get any data in the output table?
What is the prerequisites for using 'for all entries'.
Please advice me on this.
Regards
Ashish.

Hi
In this case all the records available in employee table are extracted into internal table itab_emp.
It is safe to check whether itab_dept is initial or not.
If it is initial then stop the select query.
Check the following program u will get an idea.
Also try this program by removing comment to 'REFRESH IT_LFA1'.
REPORT  ZBM_PG                                  .
TABLES: LFA1, EKKO.
DATA:
     IT_LFA1 TYPE TABLE OF LFA1 WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 10,
      IT_LFA1 TYPE TABLE OF LFA1 WITH HEADER LINE,
      IT_EKKO TYPE TABLE OF EKKO WITH HEADER LINE.
SELECT * FROM LFA1 INTO TABLE IT_LFA1 WHERE LIFNR EQ '0000001000' OR LIFNR EQ '0000001500'.
SELECT * FROM LFA1 INTO TABLE IT_LFA1 UP TO 1 ROWS.
refresh it_lfa1.
SELECT * FROM EKKO INTO TABLE IT_EKKO FOR ALL ENTRIES IN IT_LFA1 WHERE LIFNR = IT_LFA1-LIFNR.
LOOP AT IT_EKKO.
  WRITE: / IT_EKKO-LIFNR, IT_EKKO-EBELN.
ENDLOOP.
Reward me if it is useful

Similar Messages

  • Performance optimization on select query for all entries

    Hi All,
          I want to optimize the select query in my Program.
         The select query is taking lot of time to search the records for the given condition in the where clause
         and more interestingly there are no records fetched from the database as the where condition does not matches. 
         It is taking more than 30 min to search the record and the result is no record found.
         Below is my select query. I have also created the secondary Index for the same.
         In My opinion FOR ALL ENTRIES is taking lot of time. Because there are more than 1200 records in internal table t_ajot     
          select banfn  bnfpo     bsart      txz01   matnr   Werks   lgort     matkl    reswk   menge     meins   flief      ekorg  
              INTO CORRESPONDING FIELDS OF TABLE t_req
              FROM eban
                FOR ALL ENTRIES IN t_ajot
              WHERE matkl >= t_ajot-matkl_low
                AND matkl <= t_ajot-matkl_high
                AND werks = t_ajot-werks
                AND loekz = ' '
                AND badat IN s_badat
                AND bsart = 'NB'.  
        Please suggest.

    Hi,
    that,
    FOR ALL ENTRIES IN t_ajot
    WHERE matkl >= t_ajot-matkl_low
    AND matkl <= t_ajot-matkl_high
    AND werks = t_ajot-werks
    AND loekz = ' '
    AND badat IN s_badat
    AND bsart = 'NB'.
    looks strange.
    However:
    How does your index look like?
    What executoin plan do you get?
    How do the statistics look like?
    Whats the content of the variables t_ajot-... and s_badata?
    Kind regards,
    Hermann

  • Regarding Select using FOR ALL ENTRIES (FAEI)

    Hi all,
    Please help me with Select using FOR ALL ENTRIES (FAEI)
    Thanks in advns,
    Das.

    Hi,
    This version of the SELECT statement was the only way to join tables until SAP release 3.0E.  It is recommended that the SQL JOIN be used.  However, this is an alternate method of joining tables that may be used in some circumstances.  Remember, SQL JOIN doesn’t utilize the SAP internal database buffer.
    Example:
        SELECT EKGRP FROM T024
               INTO TABLE T_024.
        SELECT MATNR WERKS EKGRP FROM MARC
               INTO TABLE T_MARC
               FOR ALL ENTRIES IN T_024
               WHERE EKGRP = T_024-EKGRP.
    Prerequisites:
    The driver table cannot be empty. This would cause one full table scan.
    In general, keep the driver table as small and unique (in regards to the fields that would be needed for referencing in the FAEI) as possible. If duplicate entries are not deleted, identical data is read unnecessarily from the database.
    If FAEI is used, the selected field list must be a superset of all the key fields of the database tables used in SQL. This is absolutely required to avoid data loss since the DB interface in R/3 returns unique sets of the result set to the application program. Failing to ensure this may cause problems when you want to get all records from a database table that match a certain condition.
    Avoid using FAEI on a small DB table (like configuration tables). This could potentially cause full table scans for each FAEI packet. Even if it does index range scan, it is better to get data from the small DB tables by individual SELECT without the use of FAE.
    Always use FAEI in conjunction with a DB index otherwise it would cause multiple full table scans (one table scan for each FAEI packet).
    The first field(s) of the DB index should refer to the fields of the FAEI driver table in the SQL WHERE clause. Do not leave gaps between index fields in the WHERE clause. Inefficient index access will impact every FAEI packets.
    FAEI works best when retrieving a small percentage of data from a Database table. When a large percentage of data is needed, consider getting data out of the DB table without FAEI implementation, and then do additional filtration in your application
    Reward points if found helpfull...
    Cheers,
    Chandra Sekhar.

  • Performance Issue in Select Statement (For All Entries)

    Hello,
    I have a report where i have two select statement
    First Select Statement:
    Select A B C P Q R
         from T1 into Table it_t1
              where ....
    Internal Table it_t1 is populated with 359801 entries through this select statement.
    Second Select Statement:
    Select A B C X Y Z
         from T2 in it_t2 For All Entries in it_t1
              where A eq it_t1-A
                 and B eq it_t1-B
                 and C eq it_t1-C
    Now Table T2 contains more than 10 lac records and at the end of select statement it_t2 is populated with 844003 but it takes a lot of time (15 -20 min) to execute second select statement.
    Can this code be optimized?
    Also i have created respective indexes on table T1 and T2 for the fields in Where Condition.
    Regards,

    If you have completed all the steps mentioned by others, in the above thread, and still you are facing issues then,.....
    Use a Select within Select.
    First Select Statement:
    Select A B C P Q R package size 5000
         from T1 into Table it_t1
              where ....
    Second Select Statement:
    Select A B C X Y Z
         from T2 in it_t2 For All Entries in it_t1
              where A eq it_t1-A
                 and B eq it_t1-B
                 and C eq it_t1-C
    do processing........
    endselect
    This way, while using for all entries on T2, your it_t1, will have limited number of entries and thus the 2nd select will be faster.
    Thanks,
    Juwin

  • Dynamic SELECT containing 'FOR ALL ENTRIES'

    Hi,
        I am trying to do a slect from a table in which the table and the field to be selected will be dynamically populated using Field Symbol
    Something like this,
    SELECT * FROM <FS_TABLE>
    INTO CORRESPONDING FIELDS OF TABLE <FS_IT_TABLE>
    FOR ALL ENTRIES IN T_TABLE
    WHERE <FS_FIELD> EQ T_TABLE-FIELD1.
    I know that <FS_FIELD> cannot be used along with 'FOR ALL ENTRIES'. Is there any other way to achieve this?

    Hi!
    Try out the dynamical WHERE conditions then:
    PARAMETERS: column TYPE c LENGTH 8,
                value  TYPE c LENGTH 30.
    DATA spfli_wa TYPE spfli.
    DATA cond_syntax TYPE string.
    CONCATENATE column '= value'
                INTO cond_syntax SEPARATED BY space.
    TRY.
        SELECT SINGLE *
               FROM spfli
               INTO spfli_wa
               WHERE (cond_syntax).
      CATCH cx_sy_dynamic_osql_error.
        MESSAGE `Wrong WHERE condition!` TYPE 'I'.
    ENDTRY.
    Regards
    Tamá

  • Dynamic SELECT with FOR ALL ENTRIES IN: take 2

    Hello Xperts,
    we are now having a bit of new trouble with the following SELECT ... special thanks to Raul and Suhas for their previous contributions.
    FIELD-SYMBOLS:
            <itab1>      TYPE standard table.
      ASSIGN ATTR_T_I->* TO <itab1>.
        select
          FIELD1
          FIELD2
        from DBTAB1
        into CORRESPONDING FIELDS OF table <itab1>
        FOR ALL ENTRIES IN <itab1>
        where
           (condition).
    ATTR_T_I is a static attibute of type table containing 10 records where all records have FIELD1 and FIELD2 empty.
    The select finds in DBTAB1 entries fulfilling the 'condition' for 8 of the above 10 records in ATTR_T_I.
    Hence, after the select 8 of the 10 records in ATTR_T_I have the fields FIELD1 and FIELD2 filled (ie not empty).
    So far so good!
    BUT: the 2 remaining records (i.e. those without entries in DBTAB1 fullfilling 'condition') have been deleted! Why? This is not what we want nor expected.
    Any ideas out there how to fix this?
    Thanx!

    Martin Helmstein wrote:
    > Yes, 'condition' contains all the key fields of DBTAB1.
    Hi Martin,
    It's not the Where condition fields i was talking about. I was referring to the Select fields, you have to SELECT all the keyfields when using FAE. Something like this:
    SELECT key1 key2 ... keyn "all the key fields of the table
    field1 field2 ... fieldn
    FROM table
    INTO CORRESPONDING FIELDS OF it_data
    FOR ALL ENTRIES IN <itab>
    WHERE (condition).
    You can search in the forums for further details. It has been discussed many a times.
    BR,
    Suhas

  • Dynamic SELECT with FOR ALL ENTRIES IN

    Hello Xperts,
    we are having a bit of trouble with the following SELECT
    FIELD-SYMBOLS:
            <itab1>      TYPE standard table.
      ASSIGN ATTR_T_I->* TO <itab1>.
        select
          FIELD1
          FIELD2
        from DBTAB1
        into CORRESPONDING FIELDS OF table <itab1>
        FOR ALL ENTRIES IN <itab1>
        where
          FIELD3     =   <itab1>-FIELD3    and
          FIELD4     =   <itab1>-FIELD4
    ATTR_T_I is a static attibute of type table.
    The syntax check throws the following message:
    The specified type has no structure and therefore no component  called FIELD3.
    Any ideas out there how to solve this issue?
    Thanx!

    Hi Martin,
    Change your code like this and try.
    DATA: itab2 TYPE TABLE OF string.
    FIELD-SYMBOLS:
            <itab1>      TYPE standard table.
      ASSIGN ATTR_T_I->* TO <itab1>.
    APPEND 'FIELD3     =   <itab1>-FIELD3    and' TO itab2.
    APPEND 'FIELD4     =   <itab1>-FIELD4' TO itab2.
        select
          FIELD1
          FIELD2
        from DBTAB1
        into CORRESPONDING FIELDS OF table <itab1>
        FOR ALL ENTRIES IN <itab1>
        where
          (itab2)
    Regards,
    Rahul Muraleedharan.

  • Select using for all entries

    hi gurus,
    plz check my report using for all entries where i am give data in selection screen from date to date as 3.01.2007 to 4.02.2007
    my code does not provide me data between  above date to date.
    it fetch data from other date like 26.06.2006 to some other
    plz check code and give me solution for it.
    TABLES: bseg, bkpf.
    *ALV grid_data
    TYPE-POOLS: slis.
                           INTERNAL TABLES
    TYPES: BEGIN OF it_output,
           bukrs  TYPE bseg-bukrs, "Company Code
           belnr  TYPE bseg-belnr, "Accounting Document Number
           gjahr  TYPE bseg-gjahr, "Fiscal Year
           buzei  TYPE bseg-buzei, "Number of Line Item
           augdt  TYPE bseg-augdt, "Clearing Date
           shkzg  TYPE bseg-shkzg, "Debit/Credit Indicator
           dmbtr  TYPE bseg-dmbtr, "Amount in local currency
           kostl  TYPE bseg-kostl, "Cost Center
           hkont  TYPE bseg-hkont, "G/L Account
           matnr  TYPE bseg-matnr, "Material Number
           werks  TYPE bseg-werks, "Plant
           erfmg  TYPE bseg-erfmg, "Quantity in unit of entry
           blart  TYPE bkpf-blart, "Document type
           bldat  TYPE bkpf-bldat, "Document Date
           budat  TYPE bkpf-budat, "Posting Date
           monat  TYPE bkpf-monat, "Fiscal period
           cpudt  TYPE bkpf-cpudt, "Document Entry Date
           usnam  TYPE bkpf-usnam, "User name
           tcode  TYPE bkpf-tcode, "Transaction Code20
           bktxt  TYPE bkpf-bktxt, "Document Header Text
           waers  TYPE bkpf-waers, "Currency Key
           awtyp  TYPE bkpf-awtyp, "Reference procedure
           awkey  TYPE bkpf-awkey, "Object key
          END OF it_output.
    TYPES: BEGIN OF it_bkpf,
           bukrs  TYPE bkpf-bukrs,
           belnr  TYPE bkpf-belnr,
           gjahr  TYPE bkpf-gjahr,
           blart  TYPE bkpf-blart,
           bldat  TYPE bkpf-bldat,
           budat  TYPE bkpf-budat,
           monat  TYPE bkpf-monat,
           cpudt  TYPE bkpf-cpudt,
           usnam  TYPE bkpf-usnam,
           tcode  TYPE bkpf-tcode,
           bktxt  TYPE bkpf-bktxt,
           waers  TYPE bkpf-waers,
           awtyp  TYPE bkpf-awtyp,
           awkey  TYPE bkpf-awkey,
          END OF it_bkpf.
    DATA: lt_output TYPE it_output OCCURS 0 WITH HEADER LINE.
    DATA: lt_bkpf   TYPE it_bkpf OCCURS 0 WITH HEADER LINE.
                       ALV DECLARATION DATA                              *
    DATA: it_fieldcat   TYPE    slis_t_fieldcat_alv,
          it_heading    TYPE    slis_t_listheader,
          it_sort       TYPE    slis_t_sortinfo_alv,
          it_events     TYPE    slis_t_event,
          it_alv_event  TYPE    slis_alv_event,
          gv_repname    TYPE    syrepid,
          gv_save       TYPE    char1,
          is_layout     TYPE    slis_layout_alv.
                     SELECTION SCREEN                                    *
    SELECTION-SCREEN BEGIN OF BLOCK bl WITH FRAME TITLE text-011.
    SELECT-OPTIONS: s_bukrs FOR bseg-bukrs NO INTERVALS,
                    s_blart FOR bkpf-blart,
                    s_budat FOR bkpf-budat.
    SELECTION-SCREEN END OF BLOCK bl.
                     START OF SELECTION                                  *
    START-OF-SELECTION.
      PERFORM get_data.
                       End of Selection                                  *
    END-OF-SELECTION.
      PERFORM build_field_catalog.
      PERFORM eventstab.
      PERFORM display_data.
                             FORMS                                       *
    *&      Form  get_data
          Get Data
    FORM get_data .
      SELECT bukrs
             belnr
             gjahr
             buzei
             augdt
             shkzg
             dmbtr
             kostl
             hkont
             matnr
             werks
             erfmg
             INTO TABLE lt_output
             FROM bseg
           WHERE bukrs IN s_bukrs.
      IF sy-subrc = 0.
        SORT lt_output BY belnr.
        DELETE ADJACENT DUPLICATES FROM lt_output COMPARING ALL FIELDS.
      ENDIF.
      IF NOT lt_output[] IS INITIAL.
        SELECT bukrs
               belnr
               gjahr
               blart
               bldat
               budat
               monat
               cpudt
               usnam
               tcode
               bktxt
               waers
               awtyp
               awkey
           INTO TABLE lt_bkpf FROM bkpf
           FOR ALL ENTRIES IN lt_output
           WHERE bukrs = lt_output-bukrs AND
                 belnr = lt_output-belnr AND
                gjahr = lt_output-gjahr."AND
                 blart IN s_blart        AND
                 budat IN s_budat ."     AND
                blart = 'SA'     OR
                blart = 'SB'     OR
                blart = 'AB'     OR
                blart = 'ZC'.
    *sort lt_bkpf  by blart budat.
       DELETE lt_bkpf WHERE blart NOT IN s_blart AND
                            budat NOT IN s_budat.
      ENDIF.
      SORT lt_bkpf BY bukrs belnr.
    SORT lt_output[].
    DELETE ADJACENT DUPLICATES FROM lt_output COMPARING ALL FIELDS.
      LOOP AT lt_output.
        READ TABLE lt_bkpf WITH KEY bukrs = lt_output-bukrs
                                    belnr = lt_output-belnr
                                    budat = lt_output-budat
                                    BINARY SEARCH.
        IF sy-subrc = 0.
          MOVE: lt_bkpf-gjahr TO  lt_output-gjahr,
                lt_bkpf-belnr TO  lt_output-belnr,
                lt_bkpf-blart TO  lt_output-blart,
                lt_bkpf-bldat TO  lt_output-bldat,
                lt_bkpf-budat TO  lt_output-budat,
                lt_bkpf-monat TO  lt_output-monat,
                lt_bkpf-cpudt TO  lt_output-cpudt,
                lt_bkpf-usnam TO  lt_output-usnam,
                lt_bkpf-tcode TO  lt_output-tcode,
                lt_bkpf-bktxt TO  lt_output-bktxt,
                lt_bkpf-waers TO  lt_output-waers,
                lt_bkpf-awtyp TO  lt_output-awtyp,
                lt_bkpf-awkey TO  lt_output-awkey.
          MODIFY lt_output.
       ELSE.
         DELETE lt_output.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    "get_data
    thanks jayant

    Hi Jayant,
    You cannot retrieve data first from BSEG and then from BKPF.
    It is not correct and you cannot get the correct data.
    You should use BKPF which is header table first and then
    using for all entries retrieve data from BSEG.
    Use date field in the select statement condition for BKPF table retrieval and
    you don't have posting date field in BSEG.
    If you do like this, it will definitely work.
    Retrieve data from BKPF using date condition in SELECT statement.
    Then, using for all entries retrieve from BSEG.
    Reward if helpful.

  • The select with for all entries is not working correctly

    IF NOT i_ekko_ekpo[] IS INITIAL.
        SELECT ebeln
               ebelp
               zekkn
               vgabe
               bewtp
               menge
               bpmng
               shkzg
               INTO TABLE i_ekbe
               FROM ekbe
               FOR ALL ENTRIES IN i_ekko_ekpo
               WHERE ebeln EQ i_ekko_ekpo-ebeln.
                AND ebelp EQ i_ekko_ekpo-ebelp.
        IF sy-subrc EQ 0.
          SORT i_ekbe.
        ENDIF.
      ENDIF.
    I have a PO with 2 line items in i_ekko_ekpo. In EKBE, I have 49 recs for this PO and this select is returning only 13 recs.
    I tried by commenting EBELP and still the same result.
    Thanks
    Kiran
    Edited by: kiran dasari on May 22, 2009 9:56 PM

    Hi Sudhi, I added these now but still no charm
        SELECT ebeln
               ebelp
               zekkn
               vgabe
               bewtp
               menge
               bpmng
               shkzg
               INTO TABLE i_ekbe
               FROM ekbe
               FOR ALL ENTRIES IN i_ekko_ekpo
               WHERE ebeln EQ i_ekko_ekpo-ebeln
                 AND ebelp EQ i_ekko_ekpo-ebelp
                 AND zekkn GE '00'
                 AND vgabe IN ('1','2').
    And as per your note: in the 13 entries, am having duplicate also. This is something weird for me now.
    Any more clues.
    Thanks
    Kiran

  • How to write select query for all the user tables in database

    Can any one tell me how to select the columns from all the user tables in a database
    Here I had 3columns as input...
    1.phone no
    2.memberid
    3.sub no.
    I have to select call time,record,agn from all the tables in a database...all database tables have the same column names but some may have additional columns..
    Eg: select call time, record,agn from ah_t_table where phone no= 6186759765,memberid=j34563298
    Query has to execute not only for this table but for all user tables in the database..all tables will start with ah_t
    I am trying for this query since 30days...
    Help me please....any kind of help is appreciated.....

    Hi,
    user13113704 wrote:
    ... i need to include the symbol (') for the numbers(values) to get selected..
    eg: phone no= '6284056879'To include a single-quote in a string literal, use 2 or them in a row, as shown below.
    Starting in Oracle 10, you can also use Q-notation:
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/sql_elements003.htm#i42617
    ...and also can you tell me how to execute the output of this script. What front end are you using? If it's SQL*Plus, then you can SPOOL the query to a file, and then execute that file, like this:
    -- Suppress SQL*Plus features that interfere with raw output
    SET     FEEDBACK     OFF
    SET     PAGESIZE     0
    -- Run preliminary query to generate main query
    SPOOL     c:\my_sql_dir\all_ah_t.sql
    SELECT       'select call time, record, agn from '
    ||       owner
    ||       '.'
    ||       table_name
    ||       ' where phone_no = ''6186759765'' and memberid = j34563298'
    ||       CASE
               WHEN ROW_NUMBER () OVER ( ORDER BY  owner          DESC
                              ,        table_name      DESC
                              ) = 1
               THEN  ';'
               ELSE  ' UNION ALL'
           END     AS txt
    FROM       all_tables
    WHERE       SUBSTR (table_name, 1, 4)     = 'AH_T'
    ORDER BY  owner
    ,       table_name
    SPOOL     OFF
    -- Restore SQL*Plus features that interfere with raw output (if desired)
    SET     FEEDBACK     ON
    SET     PAGESIZE     50
    -- Run main query:
    @c:\my_sql_dir\all_ah_t.sql
    so that i form a temporary view for this script as a table(or store the result in a temp table) and my problem will be solved..Sorry, I don't understand. What is a "temporary view"?

  • "For All Entries in ITAB" -error

    Hello!
                       I am new to this ABAP. I getting one error in Select query "For All Entries" keyword. My problem is,
            Iam taking vbeln field  from the table LIPS and stored in internal table it_lips. and then based on this vbeln i am taking the material document no. field mblnr from MKPF table. The Common field present in this table is vbeln in LIPS and xblnr in MKPF.
    my select query is,
                                  select xblnr mblnr
            into corresponding fields of table it_mkpf
            from mkpf
            for all entries in it_lips
            where xblnr = it_lips-vbeln
            and blart = 'WL'.

    Hi,
    Use the below logic:
    TYPES: BEGIN OF ty_mkpf,
            mblnr TYPE mblnr,
            xblnr TYPE xblnr1,
           END OF ty_mkpf.
    TYPES: BEGIN OF ty_lips,
            vbeln TYPE vbeln_vl,
            vbeln1 TYPE xblnr1,
           END OF ty_lips.
    DATA: git_mkpf TYPE STANDARD TABLE OF ty_mkpf,
                git_lips TYPE STANDARD TABLE OF ty_lips.
    DATA: gwa_lips TYPE ty_lips.
    SELECT vbeln FROM lips INTO TABLE git_lips
    UP TO 5 ROWS.
    LOOP AT git_lips INTO gwa_lips.
      gwa_lips-vbeln1 = gwa_lips-vbeln.
      MODIFY git_lips FROM gwa_lips.
    ENDLOOP.
    SELECT mblnr xblnr
    INTO TABLE git_mkpf
    FROM mkpf
    FOR ALL ENTRIES IN git_lips
    WHERE xblnr = git_lips-vbeln1
    AND blart = 'WL'.

  • What is the use of for all entries in select statement

    what is the use of for all entries in select statement

    hi,
    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.
    *******************************8
    look another example
    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.
    Hope this helps!
    Regards,
    Anver
    <i>if hlped pls mark points</i>

  • Extract Cube data for all entries of an internal table

    Hi
    I want to fetch the data from the cube for all entries of another internal table.
    Scenario : Fetching the COMPANY_CODE and DATE into an internal table and for those company codes and Dates, I have to fetch the records of the Cube.,
    I am using the Function Module : RSDRI_INFOPROV_READ
    But not sure how to accommodate the multiple selections condition for this.
    Selection Required:
                                    *For all entries of it_cc
                                      where comp_code = it_cc-comp_code and
                                                  date = it_cc-date.*
    Please help me how to such multiple conditions and "for all entries" functionality for fetching the data from the cube.
    Thanks.
    Veera Karthik G

    HI
    You can try like this
    LOOP AT lt_donotcall_old .
    <ls_donotcall>-examination_date = sy-date.
    <ls_donotcall>-examination_time = sy-time.
    ENDLOOP.
    append it_donotcall_old.
    Reward all helpfull answers
    Regards
    Pavan

  • INNER JOIN with FOR ALL ENTRIES IN Performance ?

    I am using following the following <b>Select using Inner join with For All Entries in.</b>
          SELECT kebeln kebelp kvbeln kvbelp
            FROM ekkn AS k INNER JOIN ekbe AS b ON kebeln = bebeln
                                               AND kebelp = bebelp
            INTO TABLE gi_purchase
             FOR ALL ENTRIES
             IN gi_sales
          WHERE k~mandt EQ sy-mandt
            AND k~vbeln EQ gi_sales-vbeln
            AND k~vbelp EQ gi_sales-posnr
            AND b~budat EQ p_date.
    If i am not doing inner join then I will have to do 2 select with for all entries in on ekkn and ekbe tables and then compare them.
    <b>I want to know which one has better performance
    Inner join with for all entries in
                    or
    2 Selects with for all entries in</b>

    the join is almost aways faster:
    <a href="/people/rob.burbank/blog/2007/03/19/joins-vs-for-all-entries--which-performs-better">JOINS vs. FOR ALL ENTRIES - Which Performs Better?</a>
    <a href="http://blogs.ittoolbox.com/sap/db2/archives/for-all-entries-vs-db2-join-8912">FOR ALL ENTRIES vs DB2 JOIN</a>
    Rob

  • Inner Join with For All Entries - Performance ?

    I am using following the following <b>Select using Inner join with For All Entries in.</b>
          SELECT kebeln kebelp kvbeln kvbelp
            FROM ekkn AS k INNER JOIN ekbe AS b ON kebeln = bebeln
                                               AND kebelp = bebelp
            INTO TABLE gi_purchase
             FOR ALL ENTRIES
             IN gi_sales
          WHERE k~mandt EQ sy-mandt
            AND k~vbeln EQ gi_sales-vbeln
            AND k~vbelp EQ gi_sales-posnr
            AND b~budat EQ p_date.
    If i am not doing inner join then I will have to do 2 select with for all entries in on ekkn and ekbe tables and then compare them.
    <b>I want to know which one has better performance
    Inner join with for all entries in
                    or
    2 Selects with for all entries in</b><b></b>

    An Inner Join with for all entries should be done if you add this....
    IF NOT gi_sales[] IS INITIAL.
    SELECT k~ebeln k~ebelp k~vbeln k~vbelp
    FROM ekkn AS k INNER JOIN ekbe AS b ON k~ebeln = b~ebeln
    AND k~ebelp = b~ebelp
    INTO TABLE gi_purchase
    FOR ALL ENTRIES
    IN gi_sales
    WHERE k~mandt EQ sy-mandt
    AND k~vbeln EQ gi_sales-vbeln
    AND k~vbelp EQ gi_sales-posnr
    AND b~budat EQ p_date.
    ENDIF.
    Also, while you use an index or the complete key for the SELECT, your not going to suffer from lack of performance -;)
    Greetings,
    Blag.

Maybe you are looking for