FOR ALL ENTRIES IN with two tables

Hi Guy's,
I have two int. tables, gt_likp, gt_lips.
I need to use "FOR ALL ENTRIES IN" with this two tables.
  SELECT matnr
         vkorg
         vtweg
         ypcogsl
    FROM mvke
    INTO TABLE gt_mvke
<b>    "FOR ALL ENTRIES IN gt_likp gt_lips"</b>
    WHERE matnr = gwa_liefpos_tab-matnr
    AND vkorg = gt_likp-vkorg
    AND vtweg = gt_lips-vtweg.
How to do this?
Please Help.
Thanks in Advance.

Hi,
Fill gt_likp-vkorg values in a range(r_vkorg). Use gt_lips in FOR ALL ENTRIES.
Basically you can use only 1 internal table with FOR ALL ENTRIES statement.
SELECT matnr
vkorg
vtweg
ypcogsl
FROM mvke
INTO TABLE gt_mvke
FOR ALL ENTRIES IN gt_lips
WHERE matnr = gwa_liefpos_tab-matnr
AND       vkorg in r_vkorg
AND       vtweg = gt_lips-vtweg.
- SRao

Similar Messages

  • 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

  • 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

  • Use of for all entries in abap

    Please tell me how to use "for all entries" in linking two
    tables for retrieve informations by using corresponding fields in both the tables.plz send the codings.

    REPORT  YVCHIERSEQ                              .
    TYPE-POOLS:SLIS.
    DATA:T_VBAK TYPE STANDARD TABLE OF VBAK INITIAL SIZE 0,
         T_VBAP TYPE STANDARD TABLE OF VBAP INITIAL SIZE 0,
         W_VBAK TYPE VBAK,
         W_VBAP TYPE VBAP,
         G_VBELN TYPE VBAK-VBELN,
         W_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
         T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
         W_KEYINFO TYPE SLIS_KEYINFO_ALV.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
    SELECT-OPTIONS:S_VBELN FOR G_VBELN.
    SELECTION-SCREEN END OF BLOCK B1.
    INITIALIZATION.
    CLEAR:W_VBAK,
          W_VBAP.
    REFRESH:T_VBAK,
            T_VBAP.
    START-OF-SELECTION.
    PERFORM SUB_GET_VBAK.
    PERFORM SUB_GET_VBAP.
    PERFORM SUB_DISP_OUTPUT.
    FORM SUB_GET_VBAK.
    SELECT * FROM VBAK INTO TABLE T_VBAK WHERE VBELN IN S_VBELN.
    ENDFORM.
    FORM SUB_GET_VBAP.
    SELECT * FROM VBAP INTO TABLE T_VBAP FOR ALL ENTRIES IN T_VBAK WHERE
    VBELN = T_VBAK-VBELN.
    ENDFORM.
    FORM SUB_DISP_OUTPUT.
    W_FIELDCAT-COL_POS = 1.
    W_FIELDCAT-FIELDNAME = 'VBELN'.
    W_FIELDCAT-SELTEXT_M = 'SALESORDER'.
    W_FIELDCAT-TABNAME = 'VBAK'.
    APPEND W_FIELDCAT TO T_FIELDCAT.
    CLEAR W_FIELDCAT.
    W_FIELDCAT-COL_POS = 2.
    W_FIELDCAT-FIELDNAME = 'ERNAM'.
    W_FIELDCAT-SELTEXT_M = 'NAME'.
    W_FIELDCAT-TABNAME = 'VBAK'.
    APPEND W_FIELDCAT TO T_FIELDCAT.
    CLEAR W_FIELDCAT.
    W_FIELDCAT-COL_POS = 3.
    W_FIELDCAT-FIELDNAME = 'VBTYP'.
    W_FIELDCAT-SELTEXT_M = 'SD CATEGORY'.
    W_FIELDCAT-TABNAME = 'VBAK'.
    APPEND W_FIELDCAT TO T_FIELDCAT.
    CLEAR W_FIELDCAT.
    W_FIELDCAT-COL_POS = 4.
    W_FIELDCAT-FIELDNAME = 'KUNNR'.
    W_FIELDCAT-SELTEXT_M = 'SOLD TO PARTY'.
    W_FIELDCAT-TABNAME = 'VBAK'.
    APPEND W_FIELDCAT TO T_FIELDCAT.
    CLEAR W_FIELDCAT.
    W_FIELDCAT-COL_POS = 5.
    W_FIELDCAT-FIELDNAME = 'NETWR'.
    W_FIELDCAT-SELTEXT_M = 'NET VALUE'.
    W_FIELDCAT-TABNAME = 'VBAK'.
    APPEND W_FIELDCAT TO T_FIELDCAT.
    CLEAR W_FIELDCAT.
    W_FIELDCAT-COL_POS = 1.
    W_FIELDCAT-FIELDNAME = 'POSNR'.
    W_FIELDCAT-SELTEXT_M = 'SALES ITEM'.
    W_FIELDCAT-TABNAME = 'VBAP'.
    APPEND W_FIELDCAT TO T_FIELDCAT.
    CLEAR W_FIELDCAT.
    W_FIELDCAT-COL_POS = 2.
    W_FIELDCAT-FIELDNAME = 'MATNR'.
    W_FIELDCAT-SELTEXT_M = 'MATERIAL NO'.
    W_FIELDCAT-TABNAME = 'VBAP'.
    APPEND W_FIELDCAT TO T_FIELDCAT.
    CLEAR W_FIELDCAT.
    W_FIELDCAT-COL_POS = 3.
    W_FIELDCAT-FIELDNAME = 'MATKL'.
    W_FIELDCAT-SELTEXT_M = 'MAT GROUP'.
    W_FIELDCAT-TABNAME = 'VBAP'.
    APPEND W_FIELDCAT TO T_FIELDCAT.
    CLEAR W_FIELDCAT.
    W_FIELDCAT-COL_POS = 4.
    W_FIELDCAT-FIELDNAME = 'NETWR'.
    W_FIELDCAT-SELTEXT_M = 'NET VALUE'.
    W_FIELDCAT-TABNAME = 'VBAP'.
    APPEND W_FIELDCAT TO T_FIELDCAT.
    CLEAR W_FIELDCAT.
    W_KEYINFO-HEADER01 = 'VBELN'.
    W_KEYINFO-ITEM01   = 'VBELN'.
    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
      EXPORTING
      I_INTERFACE_CHECK              = ' '
        I_CALLBACK_PROGRAM             = SY-CPROG
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = ' '
      IS_LAYOUT                      =
        IT_FIELDCAT                    = T_FIELDCAT
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
      IT_EVENTS                      =
      IT_EVENT_EXIT                  =
        i_tabname_header               =   'VBAK'
        i_tabname_item                 = 'VBAP'
      I_STRUCTURE_NAME_HEADER        =
      I_STRUCTURE_NAME_ITEM          =
        is_keyinfo                     = W_KEYINFO
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
      tables
        t_outtab_header                = T_VBAK
        t_outtab_item                  = T_VBAP
    EXCEPTIONS
      PROGRAM_ERROR                  = 1
      OTHERS                         = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
      ENDFORM.

  • Can we use inner joins with for all entries?

    Hi,
        Can we use innerjoin on two tables MARA and MAKT against the materials in
        the  internal table.
        If so ,please let me know whether there is performance issue.Because if there is
        bad performance issue or something else like thise means,my project manager
        wont allow to include.
        So can one let me know about this.
    Thanks,
    Balaji

    Hi Arunkumar,
                               I think you are not clear.My question is can I use innerjoin with
    for all entries.For example below is my code.
    SELECT A~MATNR
             B~MAKTX
             A~MTART
             A~MATKL
             FROM MARA AS A INNER JOIN MAKT AS B
             ON AMATNR = BMATNR
             INTO TABLE IT_MARA_MAKT
             FOR ALL ENTRIES IN IT_MATNR
             WHERE A~MATNR = IT_MATNR-MATNR
             AND   A~EXTWG = P_EXTWG
             AND   A~SPART = P_SPART.
    Can we use like this for all entries along with innerjoins.
    Thanks,
    Balaji

  • 2 for all entries with different condition

    Hi
    i have an internal 2 internal table which have the following field
    ITAB1 : Stock category, plant, storage location , SKU code   (those value are given though flat file)
    ITAB2 : Grid value , meterial NO, SKU code  (those values are determine through a FM where we export the SKU code and it will retreive the matnr and grid value in an ITAB2)
    I have to do select FROM database MCHB
    with the condition Grid value , material NO , Stock category, plant, storage location
    Note that gris value and matnr are found in two different internal table i was thinking of doing for all entries but
    is it possible to do for all entries from 2 internal table
    SELECT FOROM MCHB
    FOR ALL ENTRIES in ITAB1
    FOR ALL ENTRIES in ITAB2
    WHERE
    grid value = itab2-gridvalue
    matnr = itab2-matnr
    stock cat = itab1-stock cat
    plant = itab1-plant
    storage location = itab1-storage location
    Please help on how to tackle this?

    Hi,
    You have to create a new third internal table with the fields matnr, grid value, stock category, plant and storage location....
    Then process the itab1 and get the process the itab2 for the corresponding SKU Code (which I believe is the common field for both of the internal tables) and then populate the third internal table itab3...
    Then use the itab3 for the FOR ALL ENTRIES.
    Thanks
    Naren

  • For all entries with large sets

    Hello All,
    Does for all entries have restriction that the itab should not exceed the maximum entries? Look at code below:
      select pernr raufpl raplzl catshours
             from catsdb
             into corresponding fields of table lit_catshrs
             for all entries in itab
             where pernr = itab-pernr
               and status in ('10', '20', '30')
               and workdate in s_date.
    if itab have 7000 entries in production system, will the select statement cause a short dump such as DBIF_RSQL_INVALID_RSQL?
    Thanks,
    Alex M

    Hi,
    check the sequence of the fields in the internal table lit_catshrs
    Because RSQL error occurs because of this.
    and Whenevr you use for all entries of some Internal Table it is a must to check that
    IF not ITAB[] Is initial.
    < write the select>
    endif.
    Other performance related thing w.r.t to ABAP are
    1) Dont use nested seelct statement
    2) If possible use for all entries in addition
    3) In the where addition make sure you give all the primary key
    4) Use Index for the selection criteria.
    5) You can also use inner joins
    6) You can try to put the data from the first select statement into an Itab and then in order to select the data from the second table use for all entries in.
    7) Use the runtime analysis SE30 and SQL Trace (ST05) to identify the performance and also to identify where the load is heavy, so that you can change the code accordingly
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5d0db4c9-0e01-0010-b68f-9b1408d5f234
    reward if useful
    regards,
    Anji

  • 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

  • Is "Joins & For all entries" in same SQL Query Possible?

    Hi all Professional,
    Can we use "Inner Joins" and "For All Entries In" in the same SQL Query. if possible then pls clarify this query.
    Here I am using three Transparent Table and fetching data from them.
    SELECT abukrs abelnr ahkont axref2 ashkzg awrbtr agsber azfbdt azterm amwskz asgtxt axref1 agjahr abuzei
               bkunnr bwerks bmenge bmeins bmatnr bkoart
               cbukrs cbelnr cblart cbldat cbudat cxblnr cgjahr cstgrd cstblg cstblg c~xreversal
               INTO CORRESPONDING FIELDS OF TABLE it_bsid FROM ( ( bsid AS a
               INNER JOIN acctit AS b ON abukrs = bbukrs )
               INNER JOIN bkpf AS c ON cbukrs = abukrs
                                   AND cbelnr = abelnr
                                   AND cgjahr = agjahr )
               FOR ALL ENTRIES IN it_bkpf
                  WHERE
                    a~belnr EQ it_bkpf-belnr
                AND a~gjahr EQ it_bkpf-gjahr
                AND a~bukrs EQ it_bkpf-bukrs
                AND a~gsber IN so_bus.
    After executing this query, I'm getting Dump Error.
    Error analysis
        When the program was running, it was established that more
        memory was needed than the operating system is able to provide savely.
        To avoid a system crash, you must prevent this
        situation.
                   Last error logged in SAP kernel
        Component............ "EM"
        Place................ "SAP-Server Development_DVL_01 on host Development (wp
         2)"
        Version.............. 37
        Error code........... 7
        Error text........... "Warning: EM-Memory exhausted: Workprocess gets PRIV "
        Description.......... " "
        System call.......... " "
        Module............... "emxx.c"
        Line................. 1886
    Pls resolve, if anybody knows.
    Thanks
    Devinder

    Hi,
    During testing i notice that splitting into multiple selects does improve performance. But the best performance I achieved using DB Hints instead of splitting the select statements.
    Generally performance of joins together with for all entries is bad.
    However if you will look into SAP note 1662726 you will notice that this issue (bad performance in using join and for all entries together) has been addressed.
    Even though the note is for HANA DB, FM RSDU_CREATE_HINT_FAE can be used independent of DB.
    On HANA DB performance improvement is huge (i achieved 62 seconds using DB Hints compared to 1656 seconds using for all entries). On Oracle DB the same code initially run in 99 seconds with for all entries and with DB Hints in 82 seconds for ~ 1.000.000 records and ~660 seconds compared to 1349 seconds for ~8.000.000 records..
    Sample code from SAP Note below:
    Original statement:
    SELECT COL1 COL2 COL3 COL4 COL5
      FROM TAB1
      INTO CORRESPONDING FIELDS OF TABLE LT_RESULT
      FOR ALL ENTRIES IN LT_SOURCE_TMP
      WHERE COL3 = LT_SOURCE_TMP-COL3
      AND   COL4 = LT_SOURCE_TMP-COL4
      AND   COL5 = LT_SOURCE_TMP-COL5
    Revision:
    DATA: L_T_TABLNM TYPE RSDU_T_TABLNM,
          L_LINES TYPE I,
          L_HINT TYPE RSDU_HINT.
    APPEND 'TAB1' TO L_T_TABLNM.
    L_LINES = LINES( LT_SOURCE_TMP ).
    CALL FUNCTION 'RSDU_CREATE_HINT_FAE'
      EXPORTING
        I_T_TABLNM   = L_T_TABLNM
        I_FAE_FIELDS = 3
        I_FAE_LINES  = L_LINES
        I_EQUI_JOIN  = RS_C_TRUE
      IMPORTING
        E_HINT       = L_HINT
      EXCEPTIONS
        OTHERS       = 0.
    SELECT COL1 COL2 COL3 COL4 COL5
      FROM TAB1
      INTO CORRESPONDING FIELDS OF TABLE LT_RESULT
      FOR ALL ENTRIES IN LT_SOURCE_TMP
      WHERE COL3 = LT_SOURCE_TMP-COL3
      AND   COL4 = LT_SOURCE_TMP-COL4
      AND   COL5 = LT_SOURCE_TMP-COL5
              %_HINTS ADABAS  L_HINT.
    Best regards,
    Octavian

  • Here iam using for-all-entries.

    Hi...
    2....here iam using for-all-entries.
    if the internal table is empty.then what will happen for next select statement.
    thanks and regards,
    k.swaminath

    Hi
    if you write like this
    <b>select data from table into itab where condituioj
    select data from table into itab1 for all entries in itab where condition</b>
    with out checking the weather the above select statement have data or not then it will give all the data which eist in that table
    <b>select data from table into itab where condituioj
    if not itab[] is initial
    select data from table into itab1 for all entries in itab where condition
    endif.</b>
    in this sitvation you don't get any data
    reward if usefull

  • Advice required on a select statement using "FOR ALL ENTRIES"

    Hi,
    this is really intresting ...
    I have a small requirement where in i have to find out
    the valid entries in my internal table (T_MATNR) by using a select statement to a check table (MARA) which has all the fields present in the internal table T_MATNR.
    Select statement is
    SELECT MATNR
           MTART
           from MARA
           for all entries in T_MATNR
           into table T_MATNR
           where matnr eq T_MATNR-MATNR.
    If you observe the itab in the option 'FOR ALL ENTRIES' and the destination table is the same. I want to know whether this is correct? will it cause any performance issue? right now this statement is working fine for me.

    Hi,
    U have to use
    SELECT MATNR
    MTART
    from MARA
    <b>into table I_MATNR(different table)</b>
    for all entries in T_MATNR
    where matnr eq T_MATNR-MATNR.
    If u r specifying both same table name then for what entries it will retrieve, if u have alreay selected some entries and appending u can use
    SELECT MATNR
    MTART
    from MARA
    <b>into table T_MATNR</b>where matnr eq T_MATNR-MATNR.
    then
    SELECT MATNR
    MTART
    from MARA
    <b>appending table T_MATNR</b>
    for all entries in T_MATNR
    where matnr eq T_MATNR-MATNR.
    In this way u can do.
    Hope u got it.

  • For All Entries with two tables

    Hi All,
             Can we use FOR ALL ENTRIES with two tables. for example
    SELECT * FROM MKPF INTO TABLE T_MKPF
             WHERE BUDAT IN S_BUDAT.
    SELECT * FROM MARA INTO TABLE T_MARA
             WHERE MTART IN S_MTART AND
                            MAKTL IN S_MAKTL.
    SELECT * FROM MSEG INTO TABLE T_MSEG
           FOR ALL ENTRIES IN  "T_MKPF AND T_MARA"
                  WHERE MBLNR EQ T_MKPF-MBLNR AND
                                 MATNR EQ T_MARA-MATNR.
    can we do it like this or any other way to do this plz tell. I waitting for your responce.
    Thanks
    Jitendra

    Hi,
    u cannot do like this....chek some documentation on it..
    1. duplicate rows are automatically removed
    2. if the itab used in the clause is empty , all the rows in the source table will be selected .
    3. performance degradation when using the clause on big tables.
    Say for example you have the following abap code:
    Select * from mara
    For all entries in itab
    Where matnr = itab-matnr.
    If the actual source of the material list (represented here by itab) is actually another database table, like:
    select matnr from mseg
    into corresponding fields of table itab
    where ….
    Then you could have used one sql statement that joins both tables.
    Select t1.*
    From mara t1, mseg t2
    Where t1.matnr = t2.matnr
    And T2…..
    So what are the drawbacks of using the "for all entires" instead of a join ?
    At run time , in order to fulfill the "for all entries " request, the abap engine will generate several sql statements (for detailed information on this refer to note 48230). Regardless of which method the engine uses (union all, "or" or "in" predicates) If the itab is bigger then a few records, the abap engine will break the itab into parts, and rerun an sql statement several times in a loop. This rerun of the same sql statement , each time with different host values, is a source of resource waste because it may lead to re-reading of data pages.
    returing to the above example , lets say that our itab contains 500 records and that the abap engine will be forced to run the following sql statement 50 times with a list of 10 values each time.
    Select * from mara
    Where matnr in ( ...)
    Db2 will be able to perform this sql statement cheaply all 50 times, using one of sap standard indexes that contain the matnr column. But in actuality, if you consider the wider picture (all 50 executions of the statement), you will see that some of the data pages, especially the root and middle-tire index pages have been re-read each execution.
    Even though db2 has mechanisms like buffer pools and sequential detection to try to minimize the i/o cost of such cases, those mechanisms can only minimize the actual i/o operations , not the cpu cost of re-reading them once they are in memory. Had you coded the join, db2 would have known that you actually need 500 rows from mara, it would have been able to use other access methods, and potentially consume less getpages i/o and cpu.
    In other words , when you use the "for all entries " clause instead of coding a join , you are depriving the database of important information needed to select the best access path for your application. Moreover, you are depriving your DBA of the same vital information. When the DBA monitors & tunes the system, he (or she) is less likely to recognize this kind of resource waste. The DBA will see a simple statement that uses an index , he is less likely to realize that this statement is executed in a loop unnecessarily.
    Beore using the "for all entries" clause and to evaluate the use of database views as a means to:
    a. simplify sql
    b. simplify abap code
    c. get around open sql limitations.
    check the links
    http://www.thespot4sap.com/articles/SAPABAPPerformanceTuning_ForAllEntries.asp
    The specified item was not found.
    Regards,
    Nagaraj

  • Using for all entries of two internal tables in where clause of the select

    Hi experts,
    My requirement is, need to select Marc-minbe and wrpl-sobst, for all the entries of the two internal tables it_mara , and it_t001w.
    here is the select queries i have used,
    select matnr normt from  mara into it_mara for all entries in it_data where normt = it_data-normt.
    select konnr werks from t001w into it_t001w for all entries in it_data where konnr = it_data-konnr.
    now i need to select minbe of marc table and sobse of wrpl table for all the entries of above internal tables, it_mara and it_t001w, using both matnr of it_mara and werks of it_t001w in where condition.
    Pls advise how i can do it.
    Thanks.
    Moderator message: very basic, please work on this yourself first, these forums are not a substitute for ABAP training.
    Edited by: Thomas Zloch on Dec 6, 2010 9:38 AM

    Hi
    call SE16 with table TFTIT in order to get a full list (it will be long...)
    A list of FMs with parameters can be found in table FUNCT.
    Finally go to sm37rsdf4
    that will give you all the function modules with description
    Here is the list:
    http://www.erpgenie.com/abap/functions.htm
    hope this helps...
    Regards
    CSM Reddy

  • Performance Problems with "For all Entries" and a big internal table

    We have big Performance Problems with following Statement:
    SELECT * FROM zeedmt_zmon INTO TABLE gt_zmon_help
      FOR ALL ENTRIES IN gt_zmon_help
        WHERE
        status = 'IAI200' AND
        logdat IN gs_dat AND
        ztrack = gt_zmon_help-ztrack.
    In the internal table gt_zmon_help are over 1000000 entries.
    Anyone an Idea how to improve the Performance?
    Thank you!

    >
    Matthias Weisensel wrote:
    > We have big Performance Problems with following Statement:
    >
    >  
    SELECT * FROM zeedmt_zmon INTO TABLE gt_zmon_help
    >   FOR ALL ENTRIES IN gt_zmon_help
    >     WHERE
    >     status = 'IAI200' AND
    >     logdat IN gs_dat AND
    >     ztrack = gt_zmon_help-ztrack.
    >
    > In the internal table gt_zmon_help are over 1000000 entries.
    > Anyone an Idea how to improve the Performance?
    >
    > Thank you!
    You can't expect miracles.  With over a million entries in your itab any select is going to take a bit of time. Do you really need all these records in the itab?  How many records is the select bringing back?  I'm assuming that you have got and are using indexes on your ZEEDMT_ZMON table. 
    In this situation, I'd first of all try to think of another way of running the query and restricting the amount of data, but if this were not possible I'd just run it in the background and accept that it is going to take a long time.

  • Dynamic Select Query including Dynamic Tables with For all Entries

    Hello everyone,
    I need to create a select query which involves using of Dynamic Tables.
    Suppose I have a dynamic table <d1> which consist of let say 10 records.
    Now i need to make a select query putting data into another dynamic table <d2>
    CONCATENATE keyfield '=' '<d1>' INTO g_condition SEPARATED BY space.
    CONCATENATE g_condition '-' keyfield INTO g_condition.
    SELECT * FROM (wa_all_tables-name) INTO CORRESPONDING FIELDS OF TABLE <d1>
            FOR ALL ENTRIES IN <d1>
    WHERE (g_condition).
    But it is giving dump.
    Please help me on this....

    Short text
        A condition specified at runtime has an unexpected format.
    What happened?
        Error in the ABAP Application Program
        The current ABAP program "ZNG_CUSTOMWRITE" had to be terminated because it has
        come across a statement that unfortunately cannot be executed.
    Error analysis
        An exception occurred that is explained in detail below.
        The exception, which is assigned to class 'CX_SY_DYNAMIC_OSQL_SEMANTICS', was
         not caught in
        procedure "WRITE_ARCHIVE_PROD" "(FORM)", nor was it propagated by a RAISING
         clause.
        Since the caller of the procedure could not have anticipated that the
        exception would occur, the current program is terminated.
        The reason for the exception is:
        The current ABAP program has tried to execute an Open SQL statement
        which contains a WHERE, ON or HAVING condition with a dynamic part.
        The part of the WHERE, ON or HAVING condition specified at runtime in
        a field or an internal table, contains the invalid value "ZCOURIER-ZCOURIERID".
    CONCATENATE keyfield '=' g_header INTO g_condition SEPARATED BY space.
    CONCATENATE g_condition '-' keyfield INTO g_condition.
    SELECT * FROM (wa_all_tables-name) INTO CORRESPONDING FIELDS OF TABLE <dyn_table1>
    FOR ALL ENTRIES IN <dyn_table>
      WHERE (g_condition).

Maybe you are looking for

  • Before you can perform print-related tasks such as page setup - Internet Explorer 8

    I understand there have been similar threads on this but they all related to printing directly out of Acrobat reader rather than a browser. On some machines when printing a PDF from within Internet Explorer the error "before you can perform print-rel

  • Configure ce interface to accept all frames (regardless of 802.1q tag)?

    On Solaris 9, is it possible to configure a ce interface so it accepts all Ethernet frames it receives, regardless of the presence, absence, or value of an 802.1q tag? I'm trying to run packet sniffing software on a ce interface (I'm not using the in

  • M trying to connect a wireless Samsung 2525W printer

    Hi I know it should be easy but I am trying to connect a wireless Samsung printer to my network without success It offers WPA personal or WPA2 personal - have tried both think WPA2 the right one Then offers AES or AES&TKIP - think either should work

  • The maximum value of a maximum value without making two querys of the same

    Hi, In the table cmp_lineas_cotizacion i need to take only rows with the maximum lc.mto_precio_venta of the maximum l.fec_ini_vigencia_costo of l.cod_producto, but I have the problem that cmp_lineas_cotizacion is a very load table with take to much r

  • Problems with the Period Key

    This may be strange, but when I type a period "." strange thins happen in Mail and Safari! It is as if when typing a period it is like hitting the return key! Forinstance, if I'm typing a web address in on Safari, as soon as I type a period in the ad