Error - for all entries in itab

Hello guys !!!
I have the following select queries....
select  *  from vbrp into table itab.
select * from vbpa into table i_vbpa for all entries in itab
                                     where VBELN = itab-vbeln and ( PARVW = 'Z2' or PARVW = 'Z3').
select belnr awkey from bkpf into table i_bkpf2 for all entries in itab where xblnr = itab-vbeln.
I get the following error in 3rd select query.....
When you use the addition "FOR ALL ENTRIES IN itab", the fields "XBLNR"
and "ITAB-VBELN" must have the same type and the same length.
But if i try to change the data type of the field ITAB-VBELN to  -   " VBELN(16)  TYPE C " then i get the following error....
When you use the addition "FOR ALL ENTRIES IN itab", the fields "VBELN"
and "ITAB-VBELN" must have the same type and the same length.
How to i solve this problem ?????

Hi,
This is because XBLNR is 16 char length and VBELN is of 10.
So before passing itab to 3 query;
select belnr awkey from bkpf into table i_bkpf2 for all entries in itab where xblnr = itab-vbeln.
Create an intermediate itab with structure of vbeln with length 16 and transfer all data to this itab.
Then do as;
select belnr awkey from bkpf into table i_bkpf2 for all entries in itab where xblnr = itab1-vbeln.
Since you are using only vbeln in for all entries its even enough for the intermediate itab to have only one field to hold the values of VBELN. But you should add leading zeroes( by CONVERSION_EXIT_ALPHA_INPUT) before passing it in the query.
Regards
Karthik D

Similar Messages

  • Does 'For All Entries in itab' work exactly like 'Join' statement?

    Hi,
    I would like to know that if 'For All Entries in itab' work exactly like 'Join' statement?
    If yes, then when I use 'For All Entries in itab' and a 'Join' statement seperately with the same logical conditions for both, the number of records returned by the two methods are not same. Ideally, they should both return the same number of recs.
    Can somebody help?
    With regards.

    Hi,
    for all entries will not work in the same way unless untill it should satisfy some conditions,
    it has some pre-requisests...
    like in the select clause or in where clause or in both the cluases, there should be entire key..
    then only it will behave like the join statement..
    hope i am clear.
    please revert back if u have any quiries.
    Regards,
    Sunil Kumar Mutyala.

  • "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'.

  • For all entries in itab.....

    Hi experts..
    i hv select query which looks like this...
    <b>select field1 field2 into (itab-field1, itab-field2) from dbtab1 
                                                                               where field1 in s_field1.</b>
    The problem is i hv to add another code
    <b>"for all entries in itab2
    where field2 = itab2-field2"</b>
        to this select query..
    please advice how i can do this.....
    Thanks in advance..
    -Pranati..

    Hi,
    In the following piece of code,
    select field1 field2 into (itab-field1, itab-field2) from dbtab1
    for all entries in itab2
    where field1 in s_field1
    and field2 = itab2-field2.
    change this to:
    data: begin of itab1 occurs 0,
              field1 like dbtab1-field1,
              field2 like dbtab1-field2,
           end of itab1.
    select field1 field2 into table itab1 from dbtab1
    for all entries in itab2
    where field1 in s_field1
    and field2 = itab2-field2.
    Hope this works.
    Regards
    Subramanian

  • About for all entries in itab usage issue

    hi
    i will get a lot of material information first.
    the next i will get inforamtion about table MARC AND MBEW.
    one statement i use sap function to get MARC:
      CALL FUNCTION 'MARC_ARRAY_READ'
        EXPORTING
          KZRFB                = ' '
          NEUFLAG              = ' '
          SPERRMODUS           = ' '
          STD_SPERRMODUS       = ' '
          EXCEPTION_ON_LOCK    = ' '
        IMPORTING
          RETC                 = ret
        TABLES
          IPRE01               = ipre
          MARC_TAB             = disp
        EXCEPTIONS
          ENQUEUE_MODE_CHANGED = 1
          LOCK_ON_MARC         = 2
          LOCK_SYSTEM_ERROR    = 3
          OTHERS               = 4.
    two statement if i use:
        select matnr dispo ekgrp plifz
      into table disp
      from marc
      for all entries in ipre
      where werks = ipre-werks and
            matnr = ipre-matnr.
    which one will get better performce.
    and
    if ipre table have a lot of data, so in sap what about for all entries of Limit?
    and will lose data to use for all entries of statements?
    have function in sap to get data like 'MARC_ARRAY_READ' about MEBW.
    THANK YOU!

    thank you!
    what about for all entries of Limit?
    and will lose data to use for all entries of statements?
    exist function about get MEBW ARRAY??

  • For all entries problem

    Hi experts,
    I have a below statement in my code
    "SELECT on EKPO for all entries on ITAB (which is having 4 hundread thousand recods )"
    giving dump saying "MEMORY_PGFREE_FAILED"  and "Error releasing memory block in paging"
    i need your suggestion to avoid the memory problem
    "MEMORY_PGFREE_FAILED" ?
    can we go ahead with EXTRACT logic, does this solve the memory problem?
    thoughts will be appriciated,
    Thanks,
    Shaik bhasha

    See the example code :
    REPORT  ZSPFLI  LINE-SIZE 132 LINE-COUNT 65(3)
                                                 NO STANDARD PAGE HEADING.
    TABLES:SPFLI,SCARR, SFLIGHT, SBOOK.
    SELECT-OPTIONS: MYCARRID FOR SPFLI-CARRID.
    FIELD-GROUPS: HEADER, SPFLI_FG, SFLIGHT_FG, SBOOK_FG.
    INSERT:
            SPFLI-CARRID
            SPFLI-CONNID
            SFLIGHT-FLDATE
            SBOOK-BOOKID
           INTO HEADER,
            SPFLI-CARRID
            SPFLI-CONNID
            SPFLI-CITYFROM
            SPFLI-AIRPFROM
            SPFLI-CITYTO
            SPFLI-AIRPTO
            SPFLI-DEPTIME
            SCARR-CARRNAME
          INTO SPFLI_FG,
            SFLIGHT-FLDATE
            SFLIGHT-SEATSMAX
            SFLIGHT-SEATSOCC
            SFLIGHT-PRICE
          INTO SFLIGHT_FG,
            SBOOK-BOOKID
            SBOOK-CUSTOMID
            SBOOK-CUSTTYPE
            SBOOK-SMOKER
           INTO SBOOK_FG.
    SELECT * FROM SPFLI WHERE CARRID IN MYCARRID.
      SELECT SINGLE * FROM SCARR WHERE CARRID = SPFLI-CARRID.
      EXTRACT SPFLI_FG.
      SELECT * FROM SFLIGHT
       WHERE CARRID = SPFLI-CARRID AND  CONNID = SPFLI-CONNID.
        EXTRACT SFLIGHT_FG.
        SELECT * FROM SBOOK
               WHERE CARRID = SFLIGHT-CARRID AND
               CONNID = SFLIGHT-CONNID AND FLDATE = SFLIGHT-FLDATE.
          EXTRACT SBOOK_FG.
          CLEAR SBOOK.
        ENDSELECT.
        CLEAR SFLIGHT.
      ENDSELECT.
      CLEAR SPFLI.
    ENDSELECT.
    SORT.
    LOOP.
      AT SPFLI_FG.
        FORMAT COLOR COL_HEADING.
        WRITE: / SCARR-CARRNAME,
                 SPFLI-CONNID, SPFLI-CITYFROM,
                 SPFLI-AIRPFROM, SPFLI-CITYTO, SPFLI-AIRPTO, SPFLI-DEPTIME.
        FORMAT COLOR OFF.
      ENDAT.
      AT SFLIGHT_FG.
        WRITE: /15 SFLIGHT-FLDATE, SFLIGHT-PRICE, SFLIGHT-SEATSMAX,
                   SFLIGHT-SEATSOCC.
      ENDAT.
      AT SBOOK_FG.
        WRITE: /30 SBOOK-BOOKID, SBOOK-CUSTOMID,
                     SBOOK-CUSTTYPE, SBOOK-SMOKER.
      ENDAT.
    ENDLOOP.

  • Alternative for / Problems with: "For all entries in data_package"

    Hi Guys
    I doing some ABAP in a Start Rotine in BW and would like to do the following:
      select * from /BI0/PMATERIAL into table 0mat
      for all entries in DATA_PACKAGE
      where material = DATA_PACKAGE-/bic/zmaterial.
    But I get the following error:
    E:When using the addition "FOR ALL ENTRIES IN itab", the fields "MATERIAL" and "DATA_PACKAGE-/BIC/ZMATERIAL" must have the same type and length. and length.
    ZMATERIAL:
    - Length: 28
    - Type: CHAR - Character String
    ZMATERIAL:
    - Length: 18
    - Type: CHAR - Character String
    According to the error message "For all entries" cannot be used in this case since the lengths are not identical, but is there an alternative way to do what I would like to do?
    Thanks in advance, kind regards,
    Torben

    Hi
    one thing you can try like this define one variable in other itab of same type
    then loop at the first table and assign it to new field and modify the itab
    then use this field with for all entries
    Regards
    Shiva

  • I have a problem in using  for all entries

    Hi i have a problem in using <b>for all entries</b>
    i have declared the two internal tables as below
      DATA: BEGIN OF ITAB OCCURS 10,
              EBELN LIKE EKKO-EBELN,
              LIFNR LIKE EKKO-LIFNR,
              EBELP LIKE EKBE-EBELP,
              BELNR LIKE EKBE-BELNR,
    *          MATNR LIKE EKPO-MATNR,
    *          TXZ01 LIKE EKPO-TXZ01,
              VGABE LIKE EKBE-VGABE,
              GJAHR LIKE EKBE-GJAHR,
              KNUMV LIKE EKKO-KNUMV,
         END OF ITAB.
    DATA: BEGIN OF ITAB1 OCCURS 10,
              EBELN LIKE EKPO-EBELN,
              MATNR LIKE EKPO-MATNR,
              TXZ01 LIKE EKPO-TXZ01,
              WERKS LIKE EKPO-WERKS,
              NETWR LIKE EKPO-NETWR,
              MENGE LIKE EKPO-MENGE,
              MWSKZ LIKE EKPO-MWSKZ,
              LIFNR LIKE EKKO-LIFNR,
              EBELP LIKE EKBE-EBELP,
              BELNR LIKE EKBE-BELNR,
          END OF ITAB1.
    <b>and now i have tried to move the values in those internal tables using these statements</b>
       SELECT  A~EBELN A~LIFNR A~KNUMV B~VGABE B~EBELP B~GJAHR B~BELNR
            FROM  EKKO AS A
            INNER JOIN EKBE  AS B ON  B~EBELN = A~EBELN
            INTO  CORRESPONDING
            FIELDS OF TABLE ITAB WHERE B~VGABE = '2'.
       SELECT EKPO~EBELN EKPO~MATNR EKPO~TXZ01 EKPO~WERKS EKPO~NETWR
              EKPO~MENGE EKPO~MWSKZ
          FROM EKPO
          INTO CORRESPONDING FIELDS OF TABLE ITAB1
          FOR ALL ENTRIES IN ITAB
          WHERE EBELN = ITAB-EBELN.
          LOOP AT ITAB1.
           READ TABLE ITAB WITH KEY EBELN = ITAB-EBELN.
           ITAB-EBELN = ITAB1-EBELN.
           ITAB1-LIFNR = ITAB-LIFNR.
           ITAB1-EBELP = ITAB-EBELP.
           ITAB1-BELNR = ITAB-BELNR.
           ITAB1-EBELP = ITAB-EBELP.
           APPEND ITAB1.
          ENDLOOP.
    But when i was using loop then it was displaying values in debugging mode but while i was trying to execute it was taking a lot of time i thought that it was due to more information in the already declared internal table so i have tried to remove the previous entries but it was showing an error while i was removing the old entries
    and when i  remove the loop at itab1 then i'll get output directly but it was displaying the itab fields which is my 1st internal table but not the values of itab1 can u explain me what is the possible error for that
    Regards ,
    Pavan

    before using for all entries in, u need to check whether the driver internal table is empty, if it is empty, u should not enter into select statement.
    if u wont use this check means, when the driver internal table is empty, the second select will take all the entires from the tables.
    SELECT  AEBELN ALIFNR AKNUMV BVGABE BEBELP BGJAHR B~BELNR
            FROM  EKKO AS A
            INNER JOIN EKBE  AS B ON  BEBELN = AEBELN
            INTO  CORRESPONDING
            FIELDS OF TABLE ITAB WHERE B~VGABE = '2'.
    if itab[] is not initial.
       SELECT EKPOEBELN EKPOMATNR EKPOTXZ01 EKPOWERKS EKPO~NETWR
              EKPOMENGE EKPOMWSKZ
          FROM EKPO
          INTO CORRESPONDING FIELDS OF TABLE ITAB1
          FOR ALL ENTRIES IN ITAB
          WHERE EBELN = ITAB-EBELN.
    endif.
    I hope this will help u.
    else,
    Sujatha.

  • Select query like For all Entries

    Hi,
    I have a requirement like:
    I need to extract data (BKTXT) from table BKPF based on some criteria, into one internal table and I need to query on REGUP table for the above data, the selection criteria on REGUP as follows:
    BKTXT(Document Header Text with 25 Char) is a combination of DATE and character string.
    Ex: bkpf-bktxt = 20060710-PL02 (YYYYMMDD)
    it is like LAUFD + LAUFI (of table REGUP)
    i.e: LAUFD (REGUP) = 07/10/2006 (MM/DD/YYYY) and LAUFI(REGUP) = PL02
    here I am thinking to use a select query on REGUP using FOR ALL ENTRIES of table i_bkpf..
    How can I change the date format YYYYMMDD to MM/DD/YYYY for my requirement?
    ((    Run-on Date (REGUP-LAUFD) = the first 8 characters in the Document Header Text (BKPF- BKTXT) in MM/DD/YYYY date format (e.g. 07/10/2006)
       Run ID (REGUP-LAUFI) = the 10th character through the 15th character in the Document Header Text (BKPF- BKTXT)

    It is not possible to do in the way you are thinking of doing. "For all entries" requires you to have the itab table field and the database table field to have the same type and length. So something like below <u>will not work</u>.
    TABLES: regup.
    DATA: BEGIN OF itab OCCURS 0,
            text LIKE bkpf-bktxt.
    DATA: END OF itab.
    DATA: BEGIN OF itab_regup OCCURS 0.
            INCLUDE STRUCTURE regup.
    DATA: END OF itab_regup.
    SELECT * INTO TABLE itab_regup
             FROM regup FOR ALL ENTRIES IN itab
            WHERE laufd = itab-text+0(8).
    If you run this code, you will get an error as follows:
    <i>"When using the addition "FOR ALL ENTRIES IN itab", the fields "LAUFD" and "ITAB-TEXT+0(8)" must have the same type and length."</i>

  • Select for all entries+offset

    Folks,
    please find my code below:
    SELECT partner bpkind FROM but000 INTO TABLE i_but000
        FOR ALL ENTRIES IN lt_cmst_rtcm_bw
        WHERE partner = lt_cmst_rtcm_bw-tk_partner_i+0(10).
        SORT i_but000 BY partner.
    partner is of length 10, tk_partner_i is of length 32.
    when i use this offset value for comparison, its giving me the correct output. no errors.
    but am getting this warning:
    Bei der Verwendung von FOR ALL ENTRIES wird die Längenangabe für "TK_PARTNER_I" in dieser Bedingung ignoriert.          
    Do i have to mind this warning??..
    if this is to be considered, please suggest me an alternate solution to use "For all entries" in this case.
    Thanks in advance..
    Yog

    >
    yogaprakash srirangan wrote:
    > Hi,
    >
    > Actually i am writing this code in CRM system's CMOD-User exit program.
    >
    > when i remove the offset i am getting this error:
    >
    > When using the addition "FOR ALL ENTRIES IN itab", the fields "PARTNER"     and "LT_CMST_RTCM_BW-TK_PARTNER_I" must have the same type and length.and length.     
    >
    > but with offset its generating warning and internal table is getting filled..
    >
    > so can you please explain me on this?..
    >
    > Thanks,
    > Yog
    Wow!  It seems you have indeed found a bug!  With the length specification you get a warning, without you get an error!
    I've also written a little test program
    TYPES: BEGIN OF mandt_ty,
             mandt TYPE char6,
           END OF mandt_ty.
    DATA: t_mandt TYPE STANDARD TABLE OF mandt_ty WITH NON-UNIQUE KEY mandt,
          l_mandt TYPE mandt_ty.
    DATA: lt_t000 TYPE STANDARD TABLE OF t000 WITH NON-UNIQUE KEY mandt,
          ls_t000 TYPE t000.
    l_mandt-mandt = '1201'.
    INSERT l_mandt INTO TABLE t_mandt.
    SELECT * FROM t000 INTO TABLE lt_t000 FOR ALL ENTRIES IN t_mandt WHERE mandt = t_mandt-mandt+1(3).
    *SELECT * FROM t000 INTO TABLE lt_t000 FOR ALL ENTRIES IN t_mandt WHERE mandt = t_mandt-mandt.
    LOOP AT lt_t000 INTO ls_t000.
      WRITE: ls_t000-mandt.
    ENDLOOP.
    And it seems that the offset isn't being ignored.  I've also done and SQL trace, and this confirms that the offset isn't being ignored - the SQL issued actually says SELECT WHERE "MANDT" = '020' even though I've set it in the table to be 1201.
    So it seems that, at the moment, you can safely ignore the message.  But if SAP ever enforce it, or they make it an error instead of a warning, there will be problems.
    matt

  • 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

  • HOW TO PRINT THE MATTER IN FOR ALL ENTRIES

    HI HOW T  PRINT THE FOR ALL ENTRIES MATTER

    Hi Naresh,
    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.
    When 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.
    Thanks,
    Reward If Helpful.

  • Select... for all entries in...

    Hi,
    Can anybody help me to sort out this issue. This select should work. I m filling an itab with distinct pernr. in temp it should give <b>all the records for which pernr should not be in itab.</b>
    report ZTEST4.
    data : begin of ITAB occurs 0,
            PERNR like PA0001-PERNR,
            ename like pa0001-ename,
           end of ITAB.
    data : temp like itab occurs 0 with header line.
    clear : ITAB, TEMP.
    refresh : ITAB,TEMP.
    select distinct PERNR into table ITAB from PA0001 where PERNR le 10.
    select PERNR ENAME into table TEMP from PA0001
    for all entries in ITAB where pernr not in itab-pernr.
    sort TEMP by PERNR.
    break-point.

    Hi Sagar,
    If i understand it well, you exclude all PERNR LE 10.
    But first things first.
    You cannot use the FOR ALL ENTRIES in your case (it doesn't allow the operator "NOT IN").
    Your code should be:
    REPORT ztest4.
    TYPES: BEGIN OF ty_itab,
             pernr TYPE persno,
             ename TYPE emnam,
           END OF ty_itab.
    DATA : itab TYPE ty_itab occurs 0,
           wtab TYPE ty_itab.
    CLEAR: itab,
           wtab.
    SELECT pernr ename
         INTO TABLE itab
               FROM pa0001
              WHERE pernr LE 10
           ORDER BY pernr.
    IF sy-subrc EQ 0.
      DELETE ADJACENT DUPLICATES FROM itab COMPARING pernr.
    ENDIF.
    Regards,
    Rob.

  • 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

  • Like operator in for all entries

    hi all,
    may i know how to apply like for "for all entries"
    where the first position is 9.
    syntax is incorrect. hope can get help.
    thanks
      CONCATENATE itab-xx+0(1) '%' INTO v_kstar.
      SELECT kstar txt20 INTO TABLE it_act
        FROM aaa
        FOR ALL ENTRIES IN itab
        WHERE kstar like v_kstar AND
              spras = sy-langu.

    in that case u have to call with in loop itself, may be there is another way also.
      do v_times times
         varying v_name
         from dept-dept01
         next dept-dept02.
        concatenate  p_rprctr '%' v_name into v_dep.
       concatenate '%' v_name into v_dep.
        select single mctxt into v_txt
          from cskt
          where cskt~spras = 'EN'
          and   cskt~kokrs = 'PEPS'
          and   cskt~kostl like v_dep
          and   cskt~datbi eq '99991231'.
        concatenate v_txt '-' v_name into v_txt.
        write: (47)  v_txt centered no-gap ,
              sy-vline no-gap .
        hide v_name.
      clear v_dep.
      enddo.
    its not a complete code , just a sample code.
    Regards
    Prabhu

Maybe you are looking for

  • Useing Excel table genarate the report in bi publisher 11g

    Hi All, Can anyone share your ideas pls... Using Excel files we upload the data into data set excel but could't generate the reports in Bi-Publisher 11g...we are getting the error :"Null". We are using open office...is this could be a problem..? Rgds

  • Memory consuming with Firefox 29.0.1

    Specs Pentium D 3.4 Ghz, DDR2 2 GB, 250 GB SATA with two partitions (windows and all applications partition: 18 GB free of 42 GB, other partition: 13 GB free of 190 GB) Windows 8.1 Ent 64 bit, Firefox 29.0.1 with plugins http://i.imgur.com/0tFbX0Q.jp

  • How to export customer/vendor aging detailed transactions to excel ?

    hi all, How to export customer/vendor aging detailed transactions to MS-Excel ? After entering all selection creterias,report opens up with consolidated aging details for each customer,we need to double click a customer to get detailed break up of al

  • Webservices usin java-netbeans ide

    Hi frnds Currently i am creating a webservice using java. I am using netbeans4.1 IDE. When i checked the example given in the quick start guide of Netbeans i am getting an error like cannnot find the Wscompil.class. Here iam pasting the build output

  • Throwing exception

    Hi, Well, i'm a beginner in java and what i'd like to do is to read a file and display its content (an integer) in the console. The problem is that i don't know how to treat the excpetion if the file doesn't exist. Could you help me?? Here's ma piece