For all entries : lines are missing in the results

Hi all,
I have a problem with my abap code.
some lines are missing in the results.
I have check the note 65554 but i use the version 6.40
TYPES: BEGIN OF wys_bseg,
         bukrs TYPE bsad-bukrs,
         belnr TYPE bsad-belnr,
         gjahr TYPE bsad-gjahr,
         augbl TYPE bseg-augbl,
         augdt type bseg-augdt,
         hkont TYPE bseg-hkont,
         WRBTR type bseg-WRBTR,
         KOART type bseg-KOART,
         SHKZG type bseg-SHKZG,
       END OF wys_bseg.
TYPES: begin of wys_bsas,
         bukrs TYPE bsas-bukrs,
         hkont TYPE bsas-hkont,
         augbl TYPE bsas-augbl,
         augdt type bseg-augdt,
         gjahr TYPE bsas-gjahr,
         belnr TYPE bsas-belnr,
         waers TYPE bsas-waers,
         blart TYPE bsas-blart,
         gsber TYPE bsas-gsber,
         dmbtr TYPE bsas-dmbtr,
         xblnr TYPE bsas-xblnr,
         SHKZG type bseg-SHKZG,
         zmntfact TYPE bsas-WRBTR,
       end of wys_bsas.
DATA: wt_bseg_tmp TYPE wys_bseg OCCURS 0 WITH HEADER LINE.
DATA : wt_bsas type wys_bsas occurs 0 WITH HEADER LINE.
    sort wt_bsas by bukrs belnr gjahr.
    DELETE ADJACENT DUPLICATES FROM wt_bsas COMPARING bukrs belnr gjahr.
IF NOT wt_bsas[] IS INITIAL.
    select bukrs belnr gjahr augbl augdt hkont WRBTR KOART SHKZG from
bseg into table wt_bseg_tmp
              for all entries in wt_bsas
              where bukrs EQ wt_bsas-bukrs
                and belnr EQ wt_bsas-belnr
                and gjahr EQ wt_bsas-gjahr
                and koart EQ 'D'.
ENDIF.

Hi
Yes Arun is right, INTO TABLE option delete automatically the duplicates lines, so you make sure to insert all keys in order to load all record.
Insert the field BUZEI in the structure of internal table:
TYPES: BEGIN OF wys_bseg,
         bukrs TYPE bsad-bukrs,
         belnr TYPE bsad-belnr,
         gjahr TYPE bsad-gjahr,
         buzei type bseg-buzei, <------ New field
         augbl TYPE bseg-augbl,
         augdt type bseg-augdt,
         hkont TYPE bseg-hkont,
         WRBTR type bseg-WRBTR,
         KOART type bseg-KOART,
         SHKZG type bseg-SHKZG,
       END OF wys_bseg.
Max

Similar Messages

  • All my icons are missing from the Menu bar.. help!

    Hi everyone,
    Today I noticed that all my icons are missing from the right hand side of my screen. There is no Wifi, Bluetooth, clock, or Spotlight! How does this happen?!?
    Does anyone have any solutions?
    Thanks, Timmay

    Hi
    One reason for this behaviour is installing a Front Row hack that lets you run Front Row on an unsupported Mac. If this applies to you see Dr. Smoke's Uninstalling the Front Row hack FAQ.
    Matthew Whiting

  • I had previously purchased 56 songs, over a year ago. Tonight I purchased 22 more. It seems that I am being charged for all 78 that are currently in the library. How can this be stopped?

    I had previously purchased 56 songs, over a year ago. Tonight I purchased 22 more. It seems that I am being charged for all 78 that are currently in the library. How can this be stopped?

    I doubt that this is happening.  Why do you think that you are being charged for all 78?
    Did you buy them again?
    You only buy one download, so if you downloaded them again you would have to pay again.

  • Few of my amount_cr lines are missing from the query, check GL_JE_LINES_V.

    I have a discover report which have 5 union all, and one of the select statement brings the information about the cr.type like 'MISC'from the table called ar.ar_cash_receipts_all cr.
    This query basically brings the information of amount_dr and amount_Cr from the general ledger table, the navigation for the same is as below.
    Navigation:
    Enter journals
    pick some Batch Name
    Click find button
    Place cursor on the line item from the list that has Journal Name like Miscellaneous receipts
    Click on Review Journal.
    When you check the record history pulls the information as GL_JE_LINES_V.
    I am not able to pick few of my amount_cr values.
    Tables and joints used for my query is as below.
    Please correct me if i am missing any information.
    Thanks in advance.
    Archice
    APPS.ra_customer_trx_all ct
    ,AR.ra_cust_trx_types_all ctt
    ,AR.ar_distributions_all ard
    ,apps.hz_cust_accounts_all cust
    ,AR.hz_parties cust2
    ,AR.ar_adjustments_all adj
    ,GL.gl_sets_of_books books
    where
    adj.set_of_books_id=books.set_of_books_id) and
    nvl(adj.postable,'Y')='Y') and
    adj.adjustment_id=ard.source_id) and
    ard.source_table='ADJ') and
    adj.customer_trx_id=ct.customer_trx_id)
    and ctt.cust_trx_type_id=ct.cust_trx_type_id) and
    cust.cust_account_id=decode(ctt.type,'BR',ct.drawee_id,ct.bill_to_customer_id)) and
    cust2.party_id=cust.party_id and
    ctt.set_of_books_id=books.set_of_books_id(+)

    Hi Blushadow,
    Thanks for responding my query, here is best i can mention further regarding my query problem.
    The code which I have posted earlier, has been coded by some other technical person, I have posted part of the main query which pulls ‘MISC’, the posted query is not pulling all the amount_credit (amount_cr) column information, few of the lines are missing,
    The amount_dr, amount_cr is basically called form GL_JE_LINES_V, I have checked this from record history, I want to know whether, I need any further tables to be added for the existing query, in order to pull the missing amount_cr
    Lines.
    Basically, when we check the description of the view GL_JE_LINES_V
    We have few tables.
    GL_JE_LINES JEL
    , GL_CODE_COMBINATIONS CC
    , GL_JE_LINES_RECON REC
    , GL_SYSTEM_USAGES USE
    I would like to know is there any way to use another table instead of
    GL_JE_LINES_RECON REC, because when I query it, I wont see any data from this table and this have two major joins in the mentioned view called GL_JE_LINES_V.
    Regards
    Archie

  • HT2479 I recently updated the iMovie app and now all my events are missing from the event library, although they seem to be on the external hard drive...how do I restore all the clips (I have begun to edit the clips down) I am a recent PC convert, thanks

    I just updated the imovie app and all the clips from the event library are now missing, although they seem to be on the external hard drive...I am a new mac user, so please help...thanks...

    I just updated the imovie app and all the clips from the event library are now missing, although they seem to be on the external hard drive...I am a new mac user, so please help...thanks...

  • In elements 11 all my icons are missing under the expert tab in the panel bins, How can I get these back?

    I'm using Photoshop Elements 11 and I'm wanting to add some effects and graphics. I went under the expert tab and the panel bin for the effect and graphics seems like it's not loading the icons/options, it's just blank. How can I get the panel bin to display the effects and graphics options?

    Go to
    C:\ProgramData\Adobe\Photoshop Elements\11.0
    and delete the
    ThumbDatabase.db3
    Then go to
    C:\ProgramData\Adobe\Photoshop Elements\11.0\Locale\en_us
    and delete the
    MediaDatabase.db3
    Then start the photoshop elements 11 editor and wait till the effects database rebuilds, which could take awhile, like 10 to 20 minutes, so just pse 11 idle so to speak until it completes.

  • For all entries changes the order of the itab

    Hi Experts
                 In the following query i have used two internal tables namely it_first and it_zlist.
                The material inwhich the it_zlist is different sorting order
          After executing this query, the order of the material inwhich the it_first is different from the it_zlist.
                 What could be the reason, pls explain me on this.
    select matnr test zsno ztnam from zmaster1
                into corresponding fields of table it_first
                      for all entries in it_zlist
                      where matnr = it_zlist-matnr.
    Thanks in advance.
    Regards
    Rajaram

    for all entries u should specified all primary key.
    sort by u condition.
    Effect
    If the addition FOR ALL ENTRIES is specified before the language element WHERE, then the components comp of the internal table itab can be used as operands when comparing with relational operators.
    The internal table itab must have a structured line type and the component comp must be compatible with the column col.
    The logical expression sql_cond of the WHERE condition can comprise various logical expressions by using AND and OR. However, if FOR ALL ENTRIES is specified, there must be at least one Comparison with a column of the internal table itab, which can be specified either statistically or dynamically (Release 6.40 and higher). In a statement with a SELECTstatement with FOR ALL ENTRIES, the addition ORDER BY can only be used with the addition PRIMARY KEY.
    The whole logical expression sql_cond is evaluated for each individual line of the internal table itab. The resulting set of the SELECT statement is the union of the resulting sets from the individual evaluations. Duplicate lines are automatically removed from the resulting set. If the internal table itab is empty, the whole WHERE statement is ignored and all lines in the database are put in the resulting set.
    Notes
    In Release 6.10 and higher, the same internal table can be specified after FOR ALL ENTRIES and after INTO.
    The addition FOR ALL ENTRIES is only possible before WHERE conditions of the SELECT statement.
    If the additions PACKAGE SIZE or UP TO n ROWS are specified together with FOR ALL ENTRIES, they are not passed to the database system but are applied instead to the resulting set once all selected rows on the application server have been imported.
    With duplicated rows in the resulting set, the addition FOR ALL ENTRIES has the same effect as if addition DISTINCT were specified in the definition of the selection quantity. Unlike DISTINCT, the rows are not deleted from the database system but are deleted on the application server from the resulting set.
    Addition FOR ALL ENTRIES is only possible for WHERE conditions of the SELECT statement.
    Example
    Exporting all flight data for a specified departure city. The relevant airlines and flight numbers are first put in an internal table entry_tab, which is evaluated in the WHERE condition of the subsquent SELECT statement.

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

  • Question about statement for all entries

    Hi Abap experts,
    I have a question concerning the ABAP statement for all entries.
    Explanations:
    Let’s say that my source package (Source table) contains 2 types of data:
    -type1
    -type2
    I would like to use the statement select from table into internal table
    For all entries in source package
    But the where statement changes depending on the data type (2 keys when data type is 1 and only 1 key when data type is 2) .
    So that would be:
    Type1:
    Select fields
    From table into internal table
    Where field1 = source_package-field1
    And field2 = source_package-field2.
    Type2:
    Select fields
    From table into internal table
    Where field1 = source_package-field1
    How can I merge them assming that the field od data type is ftype?
    Thanks.
    Amine

    Hi amine,
    i think this is helpful for you.
    there are 2 ways  to use the for all entries...
    1. with header line:  this method is old one. in this method the internal table (ITAB) is automatically create workarea (WA) with same name, this method 1 drawback is there where we can use WA and ITAB confused that's why this is come difficult.
    2. without header line : this is nowadays we can use this method. in this method we create separate ITAb and WA. very clear this method.
    EXAMPLES:
    1.WITH HEADER LINE METHOD:
    PARAMETERS p_kunnr TYPE kna1-kunnr.
    DATA:it_kna1 LIKE kna1 OCCURS 0 WITH HEADER LINE,
          it_adrc LIKE adrc OCCURS 0 WITH HEADER LINE,
          it_adr2 LIKE adr2 OCCURS 0 WITH HEADER LINE,
          it_adr6 LIKE adr6 OCCURS 0 WITH HEADER LINE.
    START-OF-SELECTION.
       SELECT * FROM kna1 INTO TABLE it_kna1
          UP TO 100 ROWS.
       IF NOT it_kna1[] IS INITIAL.
         SELECT * FROM adrc INTO TABLE it_adrc
         FOR ALL ENTRIES IN it_kna1
         WHERE addrnumber = it_kna1-adrnr.
       ENDIF.
       IF NOT it_adrc[] IS INITIAL.
         SELECT * FROM adr2 INTO TABLE it_adr2
         FOR ALL ENTRIES IN it_adrc
         WHERE  addrnumber = it_adrc-addrnumber.
       ENDIF.
       IF NOT it_adr2[] IS INITIAL.
         SELECT * FROM adr6 INTO TABLE it_adr6
         FOR ALL ENTRIES IN it_adr2
         WHERE  addrnumber = it_adr2-addrnumber.
       ENDIF.
       LOOP AT it_kna1.
         READ TABLE it_adrc WITH KEY addrnumber = it_kna1-adrnr.
         IF sy-subrc = 0.
         ENDIF.
         READ TABLE it_adr2 WITH KEY addrnumber = it_kna1-adrnr.
         IF sy-subrc = 0.
         ENDIF.
         READ TABLE it_adr6 WITH KEY addrnumber = it_kna1-adrnr.
         IF sy-subrc = 0.
         ENDIF.
         WRITE : it_kna1-kunnr, it_kna1-name1, it_adrc-city1, it_adrc-street, it_adrc-po_box_reg,
                      it_adr2-telnr_long, it_adr6-smtp_addr.
       ENDLOOP.
    2. WITH OUT HEADER LINE:
    TABLES: KNA1 , ADRC.
    DATA : IT_KNA1 TYPE STANDARD TABLE OF KNA1,
            IT_ADRC TYPE STANDARD TABLE OF ADRC,
            WA_KNA1 TYPE KNA1,
            WA_ADRC TYPE ADRC.
    DATA: BEGIN OF STRTYPE ,
           CUSTMERNO LIKE KNA1-KUNNR,
           FIRSTNAME LIKE KNA1-NAME1,
           LASTNAME  TYPE NAME2,
           CITY TYPE ORT01,
           STATE TYPE REGIO,
           COUNTRY TYPE LAND1,
           ADDRESS LIKE ADRC-ADDRNUMBER,
           END OF STRTYPE.
    DATA : IT_1 LIKE TABLE OF STRTYPE.
    SELECT-OPTIONS  K_kunnr FOR kna1-kunnr NO-EXTENSION.
    SELECT * FROM KNA1 INTO TABLE IT_KNA1 WHERE KUNNR IN K_KUNNR.
    IF NOT IT_KNA1[] IS INITIAL.
    SELECT * FROM ADRC INTO WA_ADRC FOR ALL ENTRIES IN IT_KNA1 WHERE ADDRNUMBER = IT_KNA1-ADRNR.
    ENDSELECT.
    ENDIF.
    LOOP AT IT_KNA1 INTO WA_KNA1.
       READ TABLE IT_ADRC INTO WA_ADRC WITH KEY ADDRNUMBER = WA_KNA1-ADRNR.
       IF SY-SUBRC = 0.
           STRTYPE-ADDRESS = WA_ADRC-ADDRNUMBER.
       ENDIF.
    APPEND  STRTYPE TO IT_1.
       WRITE : / WA_KNA1-KUNNR, WA_KNA1-NAME1, WA_KNA1-NAME2, WA_KNA1-ORT01, WA_KNA1-REGIO, WA_KNA1-LAND1, WA_ADRC-ADDRNUMBER.
    ENDLOOP.
    regards,
    roopa.k

  • Driver table in select for all entries

    anyone please let me what is driver table in select for all entries and when do we go for select for all entries

    Here is something from help
    FOR ALL ENTRIES WHERE
    Syntax
    ... FOR ALL ENTRIES IN itab WHERE ... col operator itab-comp ...
    Effect
    If the addition FOR ALL ENTRIES is specified before the language element WHERE, then the components comp of the internal table itab can be used as operands when comparing with relational operators.
    The internal table itab must have a structured line type and the component comp must be compatible with the column col.
    The logical expression sql_cond of the WHERE condition can comprise various logical expressions by using AND and OR. However, if FOR ALL ENTRIES is specified, there must be at least one Comparison with a column of the internal table itab, which can be specified either statistically or dynamically (Release 6.40 and higher). In a statement with a SELECTstatement with FOR ALL ENTRIES, the addition ORDER BY can only be used with the addition PRIMARY KEY.
    The whole logical expression sql_cond is evaluated for each individual line of the internal table itab. The resulting set of the SELECT statement is the union of the resulting sets from the individual evaluations. Duplicate lines are automatically removed from the resulting set. If the internal table itab is empty, the whole WHERE statement is ignored and all lines in the database are put in the resulting set.
    Notes
    In Release 6.10 and higher, the same internal table can be specified after FOR ALL ENTRIES and after INTO.
    The addition FOR ALL ENTRIES is only possible before WHERE conditions of the SELECT statement.
    Example
    Exporting all flight data for a specified departure city. The relevant airlines and flight numbers are first put in an internal table entry_tab, which is evaluated in the WHERE condition of the subsquent SELECT statement.
    PARAMETERS p_city TYPE spfli-cityfrom.
    TYPES: BEGIN OF entry_tab_type,
             carrid TYPE spfli-carrid,
             connid TYPE spfli-connid,
           END OF entry_tab_type.
    DATA: entry_tab   TYPE TABLE OF entry_tab_type,
          sflight_tab TYPE SORTED TABLE OF sflight
                           WITH UNIQUE KEY carrid connid fldate.
    SELECT carrid connid
           FROM spfli
           INTO CORRESPONDING FIELDS OF TABLE entry_tab
           WHERE cityfrom = p_city.
    SELECT carrid connid fldate
           FROM sflight
           INTO CORRESPONDING FIELDS OF TABLE sflight_tab
           FOR ALL ENTRIES IN entry_tab
           WHERE carrid = entry_tab-carrid AND
                 connid = entry_tab-connid.
    Regards,
    Santosh

  • Question for "FOR ALL ENTRIES"

    Some materials mentioned that If the table on which the For All Entries IN clause is based is very large, the performance will go down instead of improving. But what's the moderate size of the table used in "FOR ALL ENTRIES"?

    Hi Dan,
    Yes the material you read is correct some ways.
    For all entries can be created using this addition to the where clause in a select statement. It speeds up the performance tremendously, but the cons of using this variation are listed below
    Duplicates are automatically removed from the resulting data set. Hence care should be taken that the unique key of the detail line items should be given in the select statement.
    If the table on which the For All Entries IN clause is based is empty, all rows are selected into the destination table. Hence it is advisable to check before-hand that the first table is not empty.
    If the table on which the For All Entries IN clause is based is very large, the performance will go down instead of improving. Hence attempt should be made to keep the table size to a moderate level.
    If you using less than 1000 records then it is better to populate those entries into a range then you can use that in the select as IN option.
    If the entries are more 1000 records then it is better to use below logic
    describe table r_ebeln  lines dl_lines.
        if dl_lines >= 1.
          clear: dl_start, dl_end.
          do.
            dl_start = dl_end + 1.
            dl_end = dl_end + 1000.
            if dl_end > dl_lines.
              dl_end = dl_lines.
            endif.
            refresh: r_ebeln_temp. clear r_ebeln_temp.
            append lines of r_ebeln from dl_start to dl_end to r_ebeln_temp.
            select ebeln "PurNo
                   bukrs "ComapnyCode
                   ernam "Name
                   ekgrp "PurGRp
                   waers "Currency
                   bedat "Date
                 from ekko
                 appending  table it_ekko
                 where ebeln in r_ebeln_temp.
            if dl_end >= dl_lines.
              exit.
            endif.
          enddo.

  • How to use single buffered table with FOR ALL ENTRIES KEYWORD

    Hai,
    I'm Using TJ02T Database table, It is single buffered table but at the same time I want to use FOR ALL ENTRIES KEYWORD , Please Help me.
    Regards,
    S.Janani

    Hi,
    FOR ALL ENTRIES will not depend on the buffering nature of the table. The single buffered table will only only buffer one record into memory. You can still use the statement to query the values, but it may have performance problems if the data volume is high since the records are not completely buffered into memory, the time will spent in getting data from DB.
    Thanks..
    Preetham S

  • For All Entries is NOT better than INNER JOIN in most cases

    I quote from Siegfried Boes' excellent post here: Will writing an inner join be better or creating a view?
    For all the FOR ALL ENTRIES lovers ... there is no proof for these reappearing recommendation.
    There is nearly nobody who receives forum points, who recommends FOR ALL ENTRIES instead of Joins. What is the reason ???
    It is easier to prove the opposite. A Join is a nested loop inside the database, a FOR ALL ENTRIES is partly outside of the database. FOR ALL ENTRIES works in blocks, joins on totals.
    FOR ALL ENTRIES are not recommded on really large tables, because the chances are too high that
    too many records are transferred.
    People prefer FOR ALL ENTRIES, because JOINs are not so easy to understand. Joins can go wrong, but with a bit of understanding they can be fixed.
    Some Joins are slow and can not be fixed, but then the FOR ALL ENTRIES would be extremely slow.
    There are several kinds of views:
    - projection views, i.e. only one table involved just fields reduced
    - join views, several tables, joins conditions stored in dictionary
    - materialized views, here the joined data are actually stored in the database. Storing and synchronisation has to be done manually.
    Only the last one creates real overhead. It should be the exception.
    Join Views and Joins are nearly identical. The view is better for reuse. The join is better in complicated, becuase if the access goes wrong, it can often be fixed by adding a hint. Hints can not be added to views.
    Abraham Bukit  points out:
    If it is cluster table, (you can't use join). If it is buffered table, I would also say avoid join.
    If they all are transaction table which are not buffered and are not cluster tables.  
    He further supports Siegfried's statement that FAE is easier to undestand than INNER JOINs.
    Thomas Zloch says, regarding buffered tables:
    At least think twice, maybe compare runtimes if in doubt. 
    So, unless someone has some EVIDENCE that FOR ALL ENTRIES is better, I don't think we want to see this discussed further.
    Kind regards
    Matt

    To give food for thought here's an example I  gave in a thread:
    If you have a statement like
    SELECT ... FOR ALL ENTRIES IN FAE_itab WHERE f = FAE_itab-f.
    SAP sends it to the database depending how the parameter rsdb/prefer_union_all is set:
    rsdb/prefer_union_all = 0 =>
    SELECT ... WHERE f = FAE_itab[1]-f
              OR    f = FAE_itab[2]-f
              OR    f = FAE_itab[N]-f
    You have some influence  of the generated statement type: Instead of OR'ed fields an IN list can be used
    if you have only a single coulmn N to compare:
    rsdb/prefer_in_itab_opt parameter:
    SELECT ... WHERE f IN (itab[1]-f, itab[2]-f, ..., itab[N]-f)
    rsdb/prefer_union_all = 1 =>
    SELECT ... WHERE f = FAE_itab[1]-f
    UNION ALL SELECT ... WHERE f = FAE_itab[2]-f
    UNION ALL SELECT ... WHERE f = FAE_itab[N]-f
    see: Note 48230 - Parameters for the SELECT ... FOR ALL ENTRIES statement
    As you can see for the 2nd parameter several statements are generated and combined with a UNION ALL,
    the first setting generates statements with OR's (or uses IN  if possible) for the entries in FAE_itab.
    I give you a little example here (my parameters are set in a way that the OR's are translated to IN lists; i traced the execution in ST05)
    Select myid into table t_tabcount from mydbtable
      for all entries in t_table    " 484 entries
        where myid = t_table-myid .
    ST05 trace:
    |Transaction SEU_INT|Work process no 0|Proc.type  DIA|Client  200|User |
    |Duration |Obj. name |Op.    |Recs.|RC    |Statement|
    | 640|mydbtable |PREPARE|   |  0|SELECT WHERE "myid" IN ( :A0 , :A1 , :A2 , :A3 , :A4 ) AND "myid" = :A5|
    | 2|mydbtable |OPEN   |   |  0|SELECT WHERE "myid" IN ( 1 , 2 , 3 , 4 , 5 ) AND "myid" = 72 |
    | 2.536|mydbtable |FETCH  |    0|  1403|   |
    | 3|mydbtable |REOPEN |   |  0|SELECT WHERE "myid" IN ( 6 , 7 , 8 , 9 , 10 ) AND "myid" = 72 |
    | 118|mydbtable |FETCH  |  0|  |
    | 2|mydbtable |REOPEN |  |  0|SELECT WHERE "myid" IN ( 11 , 12 , 13 , 14 , 15 ) AND "myid" = 72     |
    | 3|mydbtable |REOPEN |  |  0|SELECT WHERE "myid" IN ( 475 , 476 , 477 , 478 , 479 ) AND "myid" = 72  |
    | 94|mydbtable |FETCH  | 0| 1403|   |
    | 2|mydbtable |REOPEN |   |  0|SELECT WHERE "myid" IN ( 480 , 481 , 482 , 483 , 484 ) AND "myid" = 72 |
    You see the IN list contained 5 entries each , wich made up about 97 statements for all 484 entries.
    For every statment you have a single fetch operation wich means a separate access to the database.
    If you would replace the FAE with a join you would only have one fetch to the database.
    With the example above we can derive these observations:
    1. From database point of view these settings kill performance when you access a big table and/or have a lot of entries or columns in your FAE_itab. Furthermore, you hide information what data you will access
    at all and thus you block the database from creating a more efficient execution plan because it DOESN'T KNOW wich data you will select in the next step. I.e. it may be more efficient to scan the table in one shot instead of having many index accesses - but the database can make this decision only if it can examine ONE statement that has ALL the information of what data to retrieve.
    2. A second impact is that with every statement execution you trigger the allocation of database resources
    wich will contribute to the overhead described above.
    Said that, FAE  can never be a replacement for joining big tables (think of having a table with thousands of records in a FAE table )
    Edited by: kishan P on Nov 2, 2010 2:16 PM - Format Fixed

  • 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

  • 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>

Maybe you are looking for

  • HT1918 Your payment method is not valid in this store?

    I try to add a payment method but although I've tried 2 valid credit cards (Visa & mastercard) I keep getting the same message! Any tips?

  • Hyperlink to SSRS Report throws JavaScript Error

    Hoping this is the right place to get help here. I'm not sure if this is an error in ASP.NET, SQL Server 2005 Reporting Services or some compatibility issue between VS 2010 and VS 2013 Express for Web. I have an ASP.NET web form written in VS 2010 /

  • When I try to log in to a site i trust, the page just stays blank after i enter password and hit enter?

    I am on a website and can move around but when I try to log into my account I put the password in and hit enter. The page then just stays white and doesn't load. Could this be an issue with the settings I have in Mozilla? IE brower works fine

  • How to install LMS 4.0 in VMware

    Hi, I need to install the LMS 4.0 with L -CWLMS-4.0-750 licenses which i have now and want to install in VMware . what is the pre-requisite of VMware for the same LMS. One more thing which I would like to know that , how to do the partition for the s

  • Dreamweaver and iweb

    Hello, I have a site (small) built with dreamweaver and I wouln't like to do it again. Is it possible to go through iweb to publish it as an iweb site ? Thank you   Mac OS X (10.4.9)