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.

Similar Messages

  • 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

  • Problem with FOR ALL ENTRIES statement

    Hi all
    please find the problem in the select statement.
    SELECT vbbe~vbeln
             vbap~vstel
             marc~dispo
             vbbe~matnr
             vbbe~kunnr
             vbbe~werks
             vbbe~mbdat
             vbbe~omeng
      INTO TABLE l_t_dvbeln
      FROM vbbe
      INNER JOIN vbak
      ON
      vbbe~vbeln = vbak~vbeln
      inner join vbap
      on
      vbbe~vbeln = vbap~vbeln and
      vbbe~matnr = vbap~matnr
      inner join marc
      on
      vbbe~matnr = marc~matnr and
      vbbe~werks = marc~werks
      FOR ALL entries IN g_t_stock
      WHERE vbbe~matnr = g_t_stock-matnr
      AND   vbbe~werks = g_t_stock-werks
      AND   vbak~vkorg = g_t_stock-vkorg
      AND   vbak~vtweg = g_t_stock-vtweg
      AND   vbbe~kunnr = g_t_stock-kunnr
      AND   vbbe~mbdat IN r_mbdat.
    g_t_stock is having only one record i.e.,
    g_t_stock-vstel = 'DF01'.
    g_t_stock-dispo = 'DEI'.
    g_t_stock-matnr = '00100833'.
    g_t_stock-maktx = 'SAC (300X400)'.
    g_t_stock-kunnr = '0000600431'.
    g_t_stock-werks = 'PF71'.
    g_t_stock-labst = '7727'.
    g_t_stock-vkorg = 'SF71'.
    g_t_stock-vtweg = 'IC'.
    and r_mbdat has the date range as
    r_mbdat-sign = I
    r_mbdat-option = BT
    r_mbdat-low = 15.05.2008
    r_mbdat-high =  08.06.2008
    In vbak vbap & marc tables i have only one record as per the above selection criteria.
    in VBBE table i have 7 records which satisfies the above criteria. But the select staement retrieves only 5 records.
    if we remove for all entries and hardcode the values in the select statement then it retrieves all 7 records.
    can anybody help me.
    what is the reason it is showing only 5 records.

    Hi all
    actually it has to retrieve the following records
    VBELN      MATNR    KUNNR WERKS  MBDAT    LABST
    30001417     00100833     600431  PF71   15.05.2008   20.000
    30001417     00100833     600431  PF71   15.05.2008   20.000
    30001417     00100833     600431  PF71   22.05.2008   5.000
    30001417     00100833     600431  PF71   22.05.2008   7.000
    30001417     00100833     600431  PF71   27.05.2008  10.000
    30001417     00100833     600431  PF71   27.05.2008  10.000
    30001417     00100833     600431  PF71   29.05.2008  10.000
    But it is retrieving only 5 records as below
    VBELN      MATNR    KUNNR WERKS  MBDAT    LABST
    30001417     00100833     600431  PF71   15.05.2008   20.000
    30001417     00100833     600431  PF71   22.05.2008   5.000
    30001417     00100833     600431  PF71   22.05.2008   7.000
    30001417     00100833     600431  PF71   27.05.2008  10.000
    30001417     00100833     600431  PF71   29.05.2008  10.000
    Please give the reason

  • Problem with for all entries

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

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

  • Problem with FOR ALL ENTRIES IN

    This is my simple source code.
    TABLES: stpo.
    DATA:  t_stpo      LIKE  stpo  OCCURS 0 WITH HEADER LINE,
    t_stpo_itm      LIKE  stpo  OCCURS 0 WITH HEADER LINE,
    t_stpo-stlnr = '00000058'.
    t_stpo-stlkn = '00000003'.
    append t_stpo.
    t_stpo-stlnr = '00000058'.
    t_stpo-stlkn = '00000007'.
    append t_stpo.
    SELECT * FROM stpo INTO TABLE t_stpo_itm
    FOR ALL ENTRIES IN t_stpo
    WHERE stlnr =  t_stpo-stlnr        " BOM No.
      AND stlkn <> t_stpo-stlkn.       " BOM item node number
    The output from this source including BOM item node number 00000003, 00000007 but at SQL stlkn <> t_stpo-stlkn doesn't effected.
    Could Anyone please tell me why?
    Are there something wrong?
    Thank you in advance.

    Hi,
    You can also Use ranges for Stlnr and Stlkn fields, instead of int table.
    TABLES: stpo.
    DATA: begin of  t_stpo OCCURS 0.
                  stlnr like stpo-stlnr,
                  stlkn  like stpo-stlkn,
                  end of t_stpo.
    data t_stpo_itm LIKE stpo OCCURS 0 WITH HEADER LINE.
    t_stpo-stlnr = '00000058'.
    t_stpo-stlkn = '00000003'.
    append t_stpo.
    clear t_stpo.
    t_stpo-stlnr = '00000058'.
    t_stpo-stlkn = '00000007'.
    append t_stpo.
    clear t_stpo.
    if not t_stpo[] is initial.
    SELECT * FROM stpo INTO TABLE t_stpo_itm
    FOR ALL ENTRIES IN t_stpo
    WHERE stlnr = t_stpo-stlnr " BOM No.
    AND stlkn <> t_stpo-stlkn. " BOM item node number
    endif.
    or you can simply write a select for STPO like this:
    SELECT * FROM stpo INTO TABLE t_stpo_itm
    WHERE stlnr = '00000058' " BOM No.
    AND ( stlkn <> '00000007' or stlkn <>  '00000003' ). " BOM item node number
    regards,
    Anji

  • Problem with for all entries in select querry

    hi,
    Hi,
    I am using select queery like this
    SELECT  version  COUNT( * ) 
    from ztbi_default_va4
    INTO  CORRESPONDING FIELDS OF TABLE   lit_new 
    FOR ALL ENTRIES IN lit_new1
    WHERE network = lit_new1-network GROUP BY version.
    this is not working showing error as:
    The addition "FOR ALL ENTRIES" excludes all aggregate functions with          
    the exception of "COUNT( * )" as the single element of the SELECT     clause.     
    I am using only count(*) ,not using othes like max,min etc,,,,,,,,,
    please suggest any missing in syntax,,,,attach relavant code using count(*) with for all entreis
    any help appriciated,,,,,
    Thanks in advance,,,,

    Hi,
    Try this -
    TYPES: begin of t_data,
                 version TYPE version,
                 count    type i,
                 end of t_data.
    DATA: i_data TYPE STANDARD TABLE OF t_data,
               wa_data TYPE t_data.
    DATA: l_version TYPE version,
               l_count TYPE i.
    SELECT  version  COUNT( * ) 
    from ztbi_default_va4
    INTO  CORRESPONDING FIELDS OF TABLE   lit_new 
    FOR ALL ENTRIES IN lit_new1
    WHERE network = lit_new1-network.
    SORT lit_new.
    LOOP AT lit_new INTO lwa_new.
        IF lwa_new EQ l_version.
          l_count = l_count + 1.
        ELSE.
          wa_data-version = l_version.
          wa_data-count = l_count + 1.
          APPEND wa_data TO i_data.
          CLEAR: wa_data.
          CLEAR: l_count.
        ENDIF.
        l_version = lwa_new-version.
        CLEAR: lwa_new.
    I hope this will do.
    Make any necessary changes.
    Regards,
    Harsh Bansal

  • Replacing a inner join with for all entries

    Hi Team,
       In a already developed program I am replacing a inner join with select query follow up with for-all-entris and passing the data to final internal table but in both the case the result should be same then only my replacement will be correct. But my no records in both cases differs. This happening because when i am selecting data from first data base table is 32 lines. then I am doing fo-all-entries moving all the duplicate entries then the no records are four. but in final internal table i am looping the first internal table. So in final internal table the no of records are 32. But in inner join query the records are 16.So please let me know how resolve this issue?
    Thanks and REgards
    Deepa

    Hi Thomas,
      Thanks for ur suggestion.
    The solved that in below.
    In select query I did not change anything The way I had written the code was correct.
    I think many of us know how to write that how to make the performance better in that way.
    I made the change when I transfered the to final internal table.
    The original Inner join code:
    select a~field1 a~field2 a~field3 b~field2 b~field3 b~field4
               from dbtab1 as a  inner join dbtab2 as b
              on a~field1 = b~field1 into it_final where
              a~field1 in s_field1. [Field1  in both the table are key field]
    Before code:
    Sort itab1 by key-fields.
    sort itab2 by keyfields.
    loop at itab1 into wa1.
    move: wa1-field1 to wa_final-field1,
               wa1-field2 to wa_final-field2,
               wa1-field3 to wa_final-field3.
    read table itab2 into wa2 witk key field1 = wa1-field1 binary search.
      if sy-subrc = 0.
      move : wa2-field2 to wa_final-field4,
                 wa2-field3 to wa_final-field5,
                 wa2-field4 to wa_final-field6.
    append wa_final to it_final.
    endif.
    Clear : wa1, wa2, wa_final.
    endloop.
    In this case if the one key fieild value is not present there in second internal table but its there in first internal table still it will read that row with 2nd internal values having zeroes. Normally what does not happen in inner join case if the key field value will same in both the case ,then that will fetch only those rows.
    Changed Code
    loop at itab1 into wa1.
    read table itab2 into wa2 witk key field1 = wa1-field1 binary search.
      if sy-subrc = 0.
    move: wa1-field1 to wa_final-field1,
               wa1-field2 to wa_final-field2,
               wa1-field3 to wa_final-field3.
      move : wa2-field2 to wa_final-field4,
                 wa2-field3 to wa_final-field5,
                 wa2-field4 to wa_final-field6.
    append wa_final to it_final.
    endif.
    Clear : wa1, wa2, wa_final.
    endloop.
    In this case the values will read to final internal table if both key field matches.
    With Regards
    Deepa

  • INNER JOIN with FOR ALL ENTRIES IN Performance ?

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

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

  • Inner Join with For All Entries - Performance ?

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

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

  • Plz help me out with for all entries

    hi to all experts,
                              This is my sample code plz tell me how to output the data.plz help me out.im very much beginner in ABAP and i dont want to use loop and endloop is there any way
                                  REPORT  Z_FORALLENTERIES                        .
    types : begin  of ty_lfa1,
              lifnr type lfa1-lifnr,
              name1 type lfa1-name1,
              land1 type lfa1-land1,
            end of ty_lfa1.
    types : begin of ty_lfb1 ,
              lifnr type lfb1-lifnr,
              bukrs type lfb1-bukrs,
              pernr type lfb1-pernr,
            end of ty_lfb1.
    types : begin of ty_lfc1 ,
              lifnr type lfc1-lifnr,
              gjahr type lfc1-gjahr,
              usnam type lfc1-usnam,
             end of ty_lfc1.
    types :  begin of ty_lfbk ,
              lifnr type lfbk-lifnr,
              banks type lfbk-banks,
              bankl type lfbk-bankl,
              bankn type lfbk-bankn,
            end of ty_lfbk.
    types : begin of ty_final,
              lifnr type lfa1-lifnr,
              name1 type lfa1-name1,
              land1 type lfa1-land1,
              bukrs type lfb1-bukrs,
              pernr type lfb1-pernr,
              gjahr type lfc1-gjahr,
              usnam type lfc1-usnam,
              banks type lfbk-banks,
              bankl type lfbk-bankl,
              bankn type lfbk-bankn,
            end of ty_final.
    data : it_lfa1 type standard table of ty_lfa1 initial size 0 with header line.
    data : it_lfb1 type standard table of ty_lfb1 initial size 0 with header line.
    data : it_lfc1 type standard table of ty_lfc1 initial size 0 with header line.
    *--internal for outputting data--
    data : it_lfbk type standard table of ty_lfbk initial size 0 with header line.
    data : it_final type  standard table of ty_final initial size 0,
           wa_final like line of it_final.
    select lifnr name1 land1
           into table it_lfa1[]
           from lfa1 up to 10 rows.
    if it_lfa1[]  is not initial.
    select lifnr bukrs pernr
           into table it_lfb1[]
           from lfb1
           for all entries in it_lfa1[]
           where lifnr eq it_lfa1-lifnr.
    endif.
    if it_lfb1[] is not initial.
    select lifnr gjahr usnam
           into table it_lfc1[]
           from lfc1
           for all entries in it_lfb1[]
           where lifnr eq it_lfb1-lifnr.
    endif.
    if it_lfc1[] is not initial.
    select lifnr banks bankl bankn
           into table it_lfbk[]
           from lfbk
           for all entries in it_lfc1[]
           where lifnr eq it_lfc1-lifnr.
    endif.

    Hi
    see this program  almost same req
    **************DATA TYPES DECLARATION **********************
    TABLES: HRP1001, HRP1026, HRP1000,PCHDY.
    TYPE-POOLS SLIS.
    TYPES :BEGIN OF ST_OUTPUT,
            COUNT TYPE STRING,
            OBJID TYPE HRP1001-OBJID,
            STEXT TYPE HRP1000-STEXT,
            BEGDA TYPE HRP1000-BEGDA,
            ENDDA TYPE HRP1000-ENDDA,
            CANCRT TYPE T77CRT-CANCRT,
            AEDTM TYPE HRP1026-AEDTM,
            UNAME TYPE HRP1026-UNAME,
            LSTEXT TYPE HRP1000-STEXT,
           RINVT TYPE T777V-RINVT,
           END OF ST_OUTPUT.
    TYPES: BEGIN OF ST_HRP1000,
            OBJID TYPE HRP1001-OBJID,
            STEXT TYPE HRP1000-STEXT,
           END OF ST_HRP1000.
    TYPES : BEGIN OF ST_HRP1001,
             OTYPE TYPE HRP1001-OTYPE,
             OBJID TYPE HRP1001-OBJID,
             RELAT type hrp1001-RELAT,
             BEGDA TYPE HRP1001-BEGDA,
             ENDDA TYPE HRP1001-ENDDA,
             SCLAS TYPE HRP1001-SCLAS,
             SOBID TYPE HRP1001-SOBID,
            END OF ST_HRP1001.
    TYPES : BEGIN OF ST_HRP1026,
             OTYPE TYPE HRP1026-OTYPE,
             OBJID TYPE HRP1001-OBJID,
             AEDTM TYPE HRP1026-AEDTM,
             UNAME TYPE HRP1026-UNAME,
             DELET TYPE HRP1026-DELET,
             CANCR TYPE HRP1026-CANCR,
            END OF ST_HRP1026.
    TYPES : BEGIN OF ST_REASON,
             CANCR TYPE HRP1026-CANCR,
             CANCRT TYPE T77CRT-CANCRT,
            END OF ST_REASON.
    TYPES : BEGIN OF ST_SOBID,
             OTYPE TYPE HRP1001-OTYPE,
             OBJID TYPE HRP1001-OBJID,
             RELAT type hrp1001-OBJID,
             BEGDA TYPE HRP1001-BEGDA,
             ENDDA TYPE HRP1001-ENDDA,
             SCLAS TYPE HRP1001-SCLAS,
             SOBID TYPE HRP1001-OBJID,
            END OF ST_SOBID.
    TYPES : BEGIN OF ST_OBJID,
             OBJID TYPE HRP1001-OBJID,
            END OF ST_OBJID.
    TYPES : BEGIN OF ST_LOCATION,
             OTYPE TYPE HRP1001-OTYPE,
             OBJID TYPE HRP1001-OBJID,
             RSIGN TYPE HRP1001-RSIGN,
             RELAT TYPE HRP1001-RELAT,
             SCLAS TYPE HRP1001-SCLAS,
             SOBID TYPE HRP1001-SOBID,
            END OF ST_LOCATION.
    TYPES : BEGIN OF ST_LOCATION1,
             OTYPE TYPE HRP1001-OTYPE,
             OBJID TYPE HRP1001-OBJID,
             RSIGN TYPE HRP1001-RSIGN,
             RELAT TYPE HRP1001-RELAT,
             SCLAS TYPE HRP1001-SCLAS,
             SOBID TYPE HRP1001-OBJID,
            END OF ST_LOCATION1.
    TYPES : BEGIN OF ST_LSTEXT,
             OTYPE TYPE HRP1000-OTYPE,
             OBJID TYPE HRP1000-OBJID,
             LSTEXT TYPE HRP1000-STEXT,
            END OF ST_LSTEXT.
    TYPES : BEGIN OF ST_OBJID_SH,
             OTYPE TYPE HRP1000-OTYPE,
             OBJID TYPE HRP1000-OBJID,
            END OF ST_OBJID_SH.
    DATA : IT_OBJID_SH TYPE STANDARD TABLE OF ST_OBJID_SH.
    DATA : WA_OBJID_SH TYPE ST_OBJID_SH.
    DATA : IT_LSTEXT TYPE STANDARD TABLE OF ST_LSTEXT.              "TOS STORE THE TEXT OF COURCE LOCATION
    DATA : WA_LSTEXT TYPE ST_LSTEXT.
    DATA : IT_LOCATION TYPE STANDARD TABLE OF ST_LOCATION.          " TO STORE THE LOCATION OF COURCE
    DATA : WA_LOCATION TYPE ST_LOCATION.
    DATA : IT_LOCATION1 TYPE STANDARD TABLE OF ST_LOCATION1.        " TO CONVERT SOBID INTO OBJID FOR COURCE LOCATION
    DATA : WA_LOCATION1 TYPE ST_LOCATION1.
    DATA : IT_SOBID TYPE STANDARD TABLE OF ST_SOBID.                " TO CHANGE THE SOBID OF HRP1001 TO OBJID OF HRP1026
    DATA : WA_SOBID TYPE ST_SOBID.                                   " BY USING FOR ALL ENTRIES
    DATA : IT_REASON TYPE STANDARD TABLE OF ST_REASON.              "TO STORE T HE REASON FOR CANCELL TEXT
    DATA : WA_REASON TYPE ST_REASON.
    DATA : IT_OUTPUT TYPE STANDARD TABLE OF ST_OUTPUT.               "OUTPUT FEILDS OF REPORT.
    DATA : WA_OUTPUT TYPE ST_OUTPUT.
    DATA : IT_OUTPUT_1 TYPE STANDARD TABLE OF ST_OUTPUT.               " TEMP OUTPUT FEILDS OF REPORT.
    DATA : WA_OUTPUT_1 TYPE ST_OUTPUT.
    DATA : IT_HRP1000 TYPE STANDARD TABLE OF ST_HRP1000.             "DATA FROM HRP1000 TABLE
    DATA : WA_HRP1000 TYPE ST_HRP1000.
    DATA : IT_HRP1001 TYPE STANDARD TABLE OF ST_HRP1001.             "DATA FROM HRP1001 TABLE
    DATA : WA_HRP1001 TYPE ST_HRP1001.
    DATA : IT_HRP1026 TYPE STANDARD TABLE OF ST_HRP1026.              "DATA FROM HRP1026 TABLE
    DATA : WA_HRP1026 TYPE ST_HRP1026.
    DATA : IT_OBJID TYPE STANDARD TABLE OF ST_OBJID.                  " TO STORE THE OBJID OF HRP1001
    DATA : WA_OBJID TYPE ST_OBJID.
    DATA: WS_FCAT    TYPE SLIS_FIELDCAT_ALV .                         " FEILDCATALOG FOR ALV REPORT
    DATA: IN_FCAT    TYPE SLIS_T_FIELDCAT_ALV.
    DATA: W_LAYOUT   TYPE SLIS_LAYOUT_ALV.
    DATA : LV_COUNT TYPE I.                                           "FEILD FOR SERIAL NUMBER
    ***************************END OF DATA DECLARATION******************************************
    ***********SELECTION SCREEN DESIGN***********************
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    *SELECT-OPTIONS : S_OTYPE FOR HRP1001-OTYPE NO INTERVALS .
    SELECT-OPTIONS : S_OBJID FOR HRP1001-OBJID NO INTERVALS .
    SELECT-OPTIONS : DATE FOR SY-DATUM NO-EXTENSION OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK B1.
    **********END OF SELECTION SCREEN DESIGN*****************
    *****INITIALIZATION VENT TO ASIGN DEFAULT VALUES TO OTYPE
    *INITIALIZATION.
    S_OTYPE-LOW = 'D'.
    S_OTYPE-SIGN = 'I'.
    S_OTYPE-OPTION = 'EQ'.
    APPEND S_OTYPE.
    CLEAR S_OTYPE.
    *************END OF EVENT INITIALIZATION*****************
    *********VALIDATION FOR SCREEN FIELDS********************
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_OBJID-LOW.
    IF S_OBJID IS NOT INITIAL.
        SELECT OTYPE OBJID FROM HRP1000
                     INTO TABLE IT_OBJID_SH
                     WHERE OTYPE = 'D'.
    IF SY-SUBRC EQ 0.
    SEARCH HELP FOR QUALIFICATION.
        CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
          EXPORTING
                 DDIC_STRUCTURE         = ' '
            RETFIELD               =  'OBJID'
                 PVALKEY                = ' '
           DYNPPROG               = SY-REPID
           DYNPNR                 = SY-DYNNR
           DYNPROFIELD            = 'S_OBJID'
                 STEPL                  = 0
                 WINDOW_TITLE           =
                 VALUE                  = ' '
           VALUE_ORG              = 'S'
                 MULTIPLE_CHOICE        = ' '
                 DISPLAY                = ' '
                 CALLBACK_PROGRAM       = ' '
                 CALLBACK_FORM          = ' '
                 MARK_TAB               =
               IMPORTING
                 USER_RESET             =
          TABLES
            VALUE_TAB              =  IT_OBJID_SH
                 FIELD_TAB              =
                 RETURN_TAB             = RETURN_TAB
                 DYNPFLD_MAPPING        =
               EXCEPTIONS
                 PARAMETER_ERROR        = 1
                 NO_VALUES_FOUND        = 2
                 OTHERS                 = 3
        IF SY-SUBRC <> 0.
              MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                      WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
       IF SY-SUBRC NE 0.
         MESSAGE 'NO RECORD FOUND FOR THE GIVEN SELECTION CRITERIA.' TYPE 'E'.
       ENDIF.
    ENDIF.
    REFRESH IT_OBJID.
    ***************VALIDATION OF SCREEN FIELDS ENDS***********
    *****************START OF SELECTION ************************
    START-OF-SELECTION.
      SELECT OTYPE
             OBJID
             RELAT
             BEGDA
             ENDDA
             SCLAS
             SOBID FROM HRP1001 INTO TABLE IT_HRP1001
                        WHERE OTYPE = 'D'
                            AND OBJID IN S_OBJID
                            AND BEGDA GE DATE-LOW
                            AND ENDDA LE DATE-HIGH
                            AND ( SCLAS = 'E' OR SCLAS = 'ET' ).
      IF SY-SUBRC NE 0.
        MESSAGE 'NO RECORD FOUND FOR THE GIVEN SELECTION CRITERIA ' TYPE 'E'.
      ENDIF.
      LOOP AT IT_HRP1001 INTO WA_HRP1001.
        WA_SOBID-OTYPE = WA_HRP1001-OTYPE.
        WA_SOBID-OBJID = WA_HRP1001-OBJID.
        WA_SOBID-RELAT = WA_HRP1001-RELAT.
        WA_SOBID-BEGDA = WA_HRP1001-BEGDA.
        WA_SOBID-ENDDA = WA_HRP1001-ENDDA.
        WA_SOBID-SCLAS = WA_HRP1001-SCLAS.
        WA_SOBID-SOBID = WA_HRP1001-SOBID.
        APPEND WA_SOBID TO IT_SOBID.
      ENDLOOP.
      SELECT OTYPE
             OBJID
             AEDTM
             UNAME
             DELET
             CANCR
            NCONT
              FROM HRP1026
              INTO TABLE IT_HRP1026
              FOR ALL ENTRIES IN IT_SOBID
                 WHERE OBJID = IT_SOBID-SOBID
                 AND ( OTYPE = 'E' OR OTYPE = 'ET' )
                     AND DELET = 'X' AND
                     BEGDA GE DATE-LOW  AND
                     ENDDA LE DATE-HIGH.
      IF SY-SUBRC EQ 0.
        SELECT OBJID
               STEXT
               FROM HRP1000
               INTO TABLE IT_HRP1000
               FOR ALL ENTRIES IN IT_SOBID
                  WHERE OBJID = IT_SOBID-SOBID AND
                        BEGDA GE DATE-LOW  AND
                        ENDDA LE DATE-HIGH.
        SELECT CANCR
               CANCRT
               FROM T77CRT
               INTO TABLE IT_REASON
               FOR ALL ENTRIES IN IT_HRP1026
               WHERE CANCR = IT_HRP1026-CANCR
                 AND LANGU = 'E' .
    ********PERFORM FOR GETTING T HE LOCATION OF THE COURCE**
      PERFORM GET_LOCATION.
    **************END OF LOCATION OF COURCE ******************
      ELSE.
        MESSAGE 'NO RECORD FOUND FOR THE GIVEN SELECTION CRITERIA ' TYPE 'E'.
      ENDIF.
    *****PERFORM FOR GETTING DATA INTO THE FINAL INTERNAL TABLE IT_OUTPUT**
      PERFORM GET_DATA.
    *********************************END OF PERFORM ET DATA ***************
    ***********LOGIC FOR PRONTING NUMBER OF RECORDS ***********************
      LV_COUNT = 0.
      LOOP  AT IT_OUTPUT INTO WA_OUTPUT.
        LV_COUNT = LV_COUNT + 1.
        WA_OUTPUT-COUNT = LV_COUNT.
        APPEND WA_OUTPUT TO IT_OUTPUT_1.
      ENDLOOP.
      REFRESH IT_OUTPUT.
      IT_OUTPUT = IT_OUTPUT_1.
    ********************END OF LOGIC FOR NUMBER OF RECORDS ***************
    ****************DISPLAYING OUTPUT BY USEING GRID DISPLAY**********
      PERFORM ALV_DISPLAY.
    ****************************END OF PERFORM FOR DISPLAYING **********
    *&      Form  PERFORM_ALV
    DISPLAY THE RECORDS IN ALV GRID FORMAT.
    FORM ALV_DISPLAY.
      PERFORM FIELD_CATALOG USING 'COUNT' 'Sr. No.'.
      PERFORM FIELD_CATALOG USING 'OBJID' 'COURCE ID.'.
      PERFORM FIELD_CATALOG USING 'STEXT' 'COURCE NAME'.
        PERFORM FIELD_CATALOG USING 'LSTEXT' 'COURCE LOATION'.
      PERFORM FIELD_CATALOG USING 'BEGDA' 'BEGIN DATE '.
      PERFORM FIELD_CATALOG USING 'ENDDA' 'END DATE '.
      PERFORM FIELD_CATALOG USING 'CANCRT' 'REASON'.
      PERFORM FIELD_CATALOG USING 'AEDTM' 'DATE Of CANCEL'.
    PERFORM FIELD_CATALOG USING 'NCONT' 'NUMBER OF BOOKINGS'.
    PERFORM FIELD_CATALOG USING 'LOCTX' 'COURCE LOCATION'.
      PERFORM FIELD_CATALOG USING 'UNAME' 'WHO CANCELLED'.
    PERFORM FIELD_CATALOG USING 'LSTEXT' 'COURCE LOATION'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_STRUCTURE_NAME = 'IT_OUTPUT'
          I_GRID_TITLE     = ' Cancelled courses with reason '
          IT_FIELDCAT      = IN_FCAT
        TABLES
          T_OUTTAB         = IT_OUTPUT.
      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.                    "PERFORM_ALV
    *&      Form  FIELD_CATALOG
          text
         -->FIELD_NAME text
         -->DIS_TEXT   text
    FORM FIELD_CATALOG USING FIELD_NAME DIS_TEXT.
      CLEAR WS_FCAT.
      WS_FCAT-TABNAME = 'IT_OUTPUT'.
      WS_FCAT-FIELDNAME = FIELD_NAME.
      WS_FCAT-SELTEXT_M = DIS_TEXT.
      APPEND WS_FCAT TO IN_FCAT .
    ENDFORM.                    "FIELD_CATALOG
    *&      Form  GET_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM GET_DATA .
    *sort it_sobid by objid.
      LOOP AT IT_SOBID INTO WA_SOBID." where otype eq s_otype and objid eq s_objid.
        READ TABLE IT_HRP1026 WITH KEY OBJID = WA_SOBID-SOBID OTYPE = WA_SOBID-SCLAS INTO WA_HRP1026.
        IF SY-SUBRC EQ 0.
          READ TABLE IT_HRP1000 WITH KEY OBJID = WA_SOBID-SOBID INTO WA_HRP1000.
       READ TABLE IT_REASON WITH KEY CANCR = WA_HRP1026-CANCR INTO WA_REASON.
          WA_OUTPUT-OBJID = WA_HRP1026-OBJID.
          WA_OUTPUT-BEGDA = WA_SOBID-BEGDA.
          WA_OUTPUT-ENDDA = WA_SOBID-ENDDA.
          WA_OUTPUT-AEDTM = WA_HRP1026-AEDTM.
          WA_OUTPUT-UNAME = WA_HRP1026-UNAME.
       WA_OUTPUT-NCONT = WA_HRP1026-NCONT.
       READ TABLE IT_HRP1000 WITH KEY OBJID = WA_SOBID-SOBID INTO WA_HRP1000.
          WA_OUTPUT-STEXT = WA_HRP1000-STEXT.
          READ TABLE IT_REASON WITH KEY CANCR = WA_HRP1026-CANCR INTO WA_REASON.
          WA_OUTPUT-CANCRT = WA_REASON-CANCRT.
          CLEAR WA_REASON-CANCRT.
          READ TABLE IT_LOCATION1 WITH KEY OBJID = WA_HRP1026-OBJID INTO WA_LOCATION1..
          READ TABLE IT_LSTEXT WITH KEY OBJID = WA_LOCATION1-SOBID OTYPE = 'F' INTO WA_LSTEXT.
                 WA_OUTPUT-LSTEXT = WA_LSTEXT-LSTEXT.
                 CLEAR WA_LSTEXT-LSTEXT.
          APPEND WA_OUTPUT TO IT_OUTPUT.
          CLEAR WA_OUTPUT.
          CLEAR WA_OUTPUT-CANCRT.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " GET_DATA
    *&      Form  GET_LOCATION
          text
    -->  p1        text
    <--  p2        text
    FORM GET_LOCATION .
    SELECT OTYPE
           OBJID
           RSIGN
           RELAT
           SCLAS
          SOBID
          FROM HRP1001
          INTO TABLE IT_LOCATION
          FOR ALL ENTRIES IN IT_HRP1026
          WHERE OTYPE = 'E' AND OBJID = IT_HRP1026-OBJID
           AND RSIGN = 'A' AND RELAT = '024' AND SCLAS = 'F'
                    AND BEGDA GE DATE-LOW AND ENDDA LE DATE-HIGH.
    IF SY-SUBRC NE 0.
        MESSAGE 'NO RECORD FOUND FOR THE GIVEN SELECTION CRITERIA ' TYPE 'E'.
      ENDIF.
      LOOP AT IT_LOCATION INTO WA_LOCATION.
        WA_LOCATION1-OTYPE = WA_LOCATION-OTYPE.
        WA_LOCATION1-OBJID = WA_LOCATION-OBJID.
            WA_LOCATION1-RSIGN = WA_LOCATION-RSIGN.
        WA_LOCATION1-RELAT = WA_LOCATION-RELAT.
        WA_LOCATION1-SCLAS = WA_LOCATION-SCLAS.
        WA_LOCATION1-SOBID = WA_LOCATION-SOBID.
        APPEND WA_LOCATION1 TO IT_LOCATION1.
       CLEAR WA_LOCATION1.
      ENDLOOP.
    SELECT OTYPE
           OBJID
           STEXT
           FROM HRP1000
           INTO TABLE IT_LSTEXT
           FOR ALL ENTRIES IN IT_LOCATION1
           WHERE OBJID = IT_LOCATION1-SOBID
              AND OTYPE = 'F'.
             AND BEGDA GE DATE-LOW
             AND ENDDA LE DATE-HIGH.
    ENDFORM.                    " GET_LOCATION
    <b>Reward if usefull</b>

  • Group by with for all entries

    Hi,
       SELECT  max( VBELN ) VGBEL VGPOS POSNR FKIMG VRKME NTGEW  MATNR ARKTX  WERKS MVGR3
           FROM VBRP
           INTO TABLE T_INVIT
           FOR ALL ENTRIES IN T_INVHD
           WHERE  VBELN = T_INVHD-VBELN
           AND    SPART = T_INVHD-SPART
           AND    werks IN swerks
           AND    mvgr3 IN smvgr3
           group by  VBELN VGBEL VGPOS POSNR FKIMG VRKME NTGEW  MATNR ARKTX  WERKS MVGR3.
    i want to (max) invoice no against a delivery i.e vgbel but in this query i am getting error that with for all entries only count *  is allowed.
    regards
    Fozia

    Hi Do this way..
    IF NOT T_INVHD[] is initial.
    LOOP AT T_INVHD
    SELECT max( VBELN ) VGBEL VGPOS POSNR FKIMG VRKME NTGEW MATNR ARKTX WERKS MVGR3
    FROM VBRP
    INTO T_INVIT
    WHERE VBELN = T_INVHD-VBELN
    AND SPART = T_INVHD-SPART
    AND werks IN swerks
    AND mvgr3 IN smvgr3
    group by VGBEL VGPOS POSNR FKIMG VRKME NTGEW MATNR ARKTX WERKS MVGR3.
    IF SY-SUBRC = 0.
    APPEND T_INVIT.
    CLEAR T_INVIT
    ENDIF.
    endselect.
    endloop.
    endif.
    EVEN NO EFFECT ON PERFORMANCE
    RGDS
    RAJESH

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

  • Alternate Index not read with FOR ALL ENTRIES

    I have a select statement like:
          SELECT d~dokar
                 d~doknr
                 d~dokvr
                 d~doktl
                 l~lifnr
                 l~stcd1
                 l~stcd2
                  APPENDING CORRESPONDING FIELDS OF TABLE t_dms
                 FROM lfa1 AS l JOIN drad AS d
                      ON llifnr = dobjky
                 FOR ALL ENTRIES IN t_infile
                 WHERE  ( l~stcd2 =  t_infile-taxcode2ssn
                    OR  l~stcd2 =  t_infile-taxcode2fed
                    OR  l~stcd2 =  t_infile-fedtaxid2 )
                   AND  d~dokob =  'LFA1'
                   AND  d~obzae =  '0000'
                   AND  d~doktl IN s_doktl.
    I have defined an alternate index on LFA1 called ZX2 (MANDT, STCD2). T_INFILE is sorted by a field called FEDTAXID. This is a nine character field. TAXCODE2SSN is the same number but it is formatted 999-99-9999. TAXCODE2FED is the same number only formated 99-0000000. FEDTAXID2 is the same as FEDTAXID.
    S_DOKTL is defined as sign = I, Option = BT, Low = 000, High = 000.
    The problem is LFA1ZX2 is not being used. The file is being read sequentially. Any ideas what is causing the alternate index to be ignored?  I wrote another select statement where I removed the FOR ALL ENTRIES and the "ddoktl IN s_doktl" and the alternate index is being used. Any thoughts?
    Thanks,

    It's probably the OR-condition causing the problem. An alternative could be a driver table (t_infile or a new one) that does not have one line with three tax code variations but rather one line for each variation in  one generic column. If this driver table is sorted by tax code and stripped of duplicates, there might be an improvement possible.
    Thomas

  • How does select stmt with for all entries uses Indexes

    Hello all,
    I goes through a number of documents but still confused how does select for all entries uses indexes if fields are not in sequences. i got pretty much the same results if i take like two cases on Hr tables HRP1000 and HRP1001(with for all entries based upon hrp1000). Here is the sequence of index fields on hrp1001 (MANDT, OTYPE, OBJID, PLVAR, RSIGN, RELAT, ISTAT, PRIOX, BEGDA, ENDDA, VARYF, SEQNR). in second case objid field is in sequence as in defined Index but i dont see significant increase in field even though the number of records are around 30000. My question is does it make a differrence to use field sequence (same as in table indexes) in comparison to redundant field sequence (not same as defined in table indexes), secondly how we can ge tto know if table index is used in Select for entries query i tried Explain in ST05 but its not clear if it uses any index at all in hrp1001 read.
    here is the sample code i use to get test results.
    test case 1
    REPORT  zdemo_perf_select.
    DATA: it_hrp1000 TYPE STANDARD TABLE OF hrp1000 WITH HEADER LINE.
    DATA: it_hrp1001 TYPE STANDARD TABLE OF hrp1001 WITH HEADER LINE.
    DATA: it_hrp1007 TYPE STANDARD TABLE OF hrp1007 WITH HEADER LINE.
    DATA: it_pa0000 TYPE STANDARD TABLE OF pa0000 WITH HEADER LINE.
    DATA: it_pa0001 TYPE STANDARD TABLE OF pa0001 WITH HEADER LINE.
    DATA: it_pa0002 TYPE STANDARD TABLE OF pa0002 WITH HEADER LINE.
    DATA: it_pa0105_10 TYPE STANDARD TABLE OF pa0105 WITH HEADER LINE.
    DATA: it_pa0105_20 TYPE STANDARD TABLE OF pa0105 WITH HEADER LINE.
    DATA: t1 TYPE timestampl,
          t2 TYPE timestampl,
          t3 TYPE timestampl 
    SELECT * FROM hrp1000 CLIENT SPECIFIED  INTO TABLE it_hrp1000 bypassing buffer
                WHERE mandt EQ sy-mandt AND
                      plvar EQ '01' AND
                      otype EQ 'S'AND
                      istat EQ '1' AND
                      begda <= sy-datum AND
                      endda >= sy-datum AND
                      langu EQ 'EN'.
    GET TIME STAMP FIELD t1.
    SELECT * FROM hrp1001 CLIENT SPECIFIED INTO TABLE it_hrp1001 bypassing buffer
                FOR ALL ENTRIES IN it_hrp1000
                 WHERE mandt EQ sy-mandt AND
                        otype EQ 'S' AND
    *                    objid EQ it_hrp1000-objid and
                        plvar EQ '01' AND
                        rsign EQ 'B' AND
                        relat EQ '007' AND
                        istat EQ '1' AND
                        begda LT sy-datum AND
                        endda GT sy-datum and
                        sclas EQ 'C' and
                        objid EQ it_hrp1000-objid.
    *                    %_hints mssqlnt 'INDEX(HRP1001~0)'.
    *delete it_hrp1001 where sclas ne 'C'.
    GET TIME STAMP FIELD t2.
    t3 = t1 - t2.
    WRITE: 'Time taken - ', t3.
    test case 2
    REPORT  zdemo_perf_select.
    DATA: it_hrp1000 TYPE STANDARD TABLE OF hrp1000 WITH HEADER LINE.
    DATA: it_hrp1001 TYPE STANDARD TABLE OF hrp1001 WITH HEADER LINE.
    DATA: it_hrp1007 TYPE STANDARD TABLE OF hrp1007 WITH HEADER LINE.
    DATA: it_pa0000 TYPE STANDARD TABLE OF pa0000 WITH HEADER LINE.
    DATA: it_pa0001 TYPE STANDARD TABLE OF pa0001 WITH HEADER LINE.
    DATA: it_pa0002 TYPE STANDARD TABLE OF pa0002 WITH HEADER LINE.
    DATA: it_pa0105_10 TYPE STANDARD TABLE OF pa0105 WITH HEADER LINE.
    DATA: it_pa0105_20 TYPE STANDARD TABLE OF pa0105 WITH HEADER LINE.
    DATA: t1 TYPE timestampl,
          t2 TYPE timestampl,
          t3 TYPE timestampl 
    SELECT * FROM hrp1000 CLIENT SPECIFIED  INTO TABLE it_hrp1000 bypassing buffer
                WHERE mandt EQ sy-mandt AND
                      plvar EQ '01' AND
                      otype EQ 'S'AND
                      istat EQ '1' AND
                      begda <= sy-datum AND
                      endda >= sy-datum AND
                      langu EQ 'EN'.
    GET TIME STAMP FIELD t1.
    SELECT * FROM hrp1001 CLIENT SPECIFIED INTO TABLE it_hrp1001 bypassing buffer
                FOR ALL ENTRIES IN it_hrp1000
                 WHERE mandt EQ sy-mandt AND
                        otype EQ 'S' AND
                        objid EQ it_hrp1000-objid and
                        plvar EQ '01' AND
                        rsign EQ 'B' AND
                        relat EQ '007' AND
                        istat EQ '1' AND
                        begda LT sy-datum AND
                        endda GT sy-datum and
                        sclas EQ 'C'." and
    *                    objid EQ it_hrp1000-objid.
    *                    %_hints mssqlnt 'INDEX(HRP1001~0)'.
    *delete it_hrp1001 where sclas ne 'C'.
    GET TIME STAMP FIELD t2.
    t3 = t1 - t2.
    WRITE: 'Time taken - ', t3.

    Mani wrote:
    Thank you for your answer, its very helpful but i am still nor sure how does parameter rsdb/max_blocking_factor affect records size.
    Hi,
    The blocking affects the size of the statement and the memory structures for returning the result.
    So if your itab has 500 rows and your blocking is 5, the very same statement will be executed 100 times.
    Nothing good or bad about this so far.
    Assume, your average result for an inlist 5 statement is 25 records with an average size of 109 bytes.
    You average result size will be 2725 byte plus overhead which will nearly perfectly fit into two 1500 byte ethernet frames.
    Nothing to do in this case.
    Assume your average result for an inlist 5 statement is 7 records with an average size of 67 bytes.
    You average result size will be ~ 470 byte plus overhead which will only fill 1/3 of a 1500 byte ethernet frame.
    In this case, setting the blocking to 12 ... 15 will give you 66% network transfer performance gain,
    and reduces the number of calls to the DB by 50%, giving additional benefit.
    Now this is an extreme example. The longer the average row length is, the lower will be the average loss in the network.
    You have the same effects in memory structures, but on that layer you are fighting single micro seconds instead of
    hundreds of these, so in real life it is rarely measurable.
    Depending on table-statistics, oracle might decide for short inlists to use a concatanation instead of an inlist.
    This is supposed to be more costy, but I never had a case where I could proove a big difference.
    Values from 5 to 15 for blocking seem to be ok for me. If you have special statements in customer coding,
    it #might# be benefitial to do the mentioned calculations and do some network tracing to see if you can squeeze your
    network efficiency by tuning the blocking.
    If you have jumbo frames enabled, it might be worth to be analyzed as well.
    If you are only on a DB-CI system that is loopback connected to the DB, I doubt there might be a big outcome.
    Hope this helps
    Volker

  • 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

Maybe you are looking for