FETCH is taking lot of time when executing the program

Hi,
A program is lot of time in production though code looks ok.
Only one select statement is there which fetches data from BKPF.
Cost of the statement is as below:
SELECT STATEMENT ( Estimated Costs = 51 , Estimated #Rows = 1 )
       2 TABLE ACCESS BY INDEX ROWID BKPF
         ( Estim. Costs = 51 , Estim. #Rows = 1 )
         Estim. CPU-Costs = 1,938,416 Estim. IO-Costs = 51
         Filter Predicates
           1 INDEX RANGE SCAN BKPF~Z1
             ( Estim. Costs = 51 , Estim. #Rows = 1 )
             Search Columns: 4
             Estim. CPU-Costs = 1,936,841 Estim. IO-Costs = 50
             Access Predicates Filter Predicates
And in Se30 Execution time in Data base is 98.7% and Abap is 1.2%
When I checked the Trace I found that the 2,487,732 & 84720,805 secs is being taken in the FETCH stage.
     27     BKPF               REOPEN               0     SELECT WHERE "MANDT" = '600' AND "GJAHR" = 2003 AND "BUKRS" = '0301' AND "BLART" = 'ZA' AND "BUDAT" = 20030319 AND "STBLG" = ' '
     2,487,732     BKPF               FETCH     406          0                                                  
     84,720,805     BKPF               FETCH     377          1403                                                  
Can you please let me know what wrong in this? And what can I do to tune this fetch statement?
Regards,
Pooja

Hi,
so we can only use
(MANDT)?
BUKRS
BLART
as access predicates and
STBLG
as filter predicate.
BUDAT schould be part of the access predicates i think.
Watch out for an index where BUDAT can be used as access predicate....
Kind regards,
Hermann

Similar Messages

  • Difference between DB time OLAP time frontend time when execute the query

    hi all,
    can you any one explain the difference between DB time, OLAP time, frontend time when execute the query

    Each BEx quey form a SQL query which is called query execution plan.
    So,
    DB Time is the time taken to read the record from data base by the SQL statement.
    OLAP time is the time taken to process the calculations/formula involved.
    Frontend Time is the time taken to present the output. For ex: while displaying the data in Bex analyser if your query involves a hierarchy, then the presentation time will be more. It also includes the time user taken to enter the query selection input.

  • Background job is taking lot of time for processing the job.

    One background job - which is processing Idocs is processing a job for more than 2000+ seconds.. and completed tho.
    But this is happening for the past few days.. is there any way to trouble shoot, or find from any logs of this completed job, to find out why it was taking lot of time for processing.
    Can you please tell me the steps of analyzing / trouble shooting why it was taking lot of time daily.
    Regards,
    Satish.

    Hi Satish,
    Run DB stat from db13 it will improve the performance.
    Check number of idocs. You can send part by part, instead of sending huge data.
    Check SM58 logs
    Suman

  • How to send files to others mail id when executing the program

    Hi all,
    I am getting text file from application server and i am sending total text file data into my internal table.
    I am checking this internal table data especially material number and customer number with data base tables mara and kna1.If the matnr and kunnr are existing in database successfully means then only i am creating the sales orders for that text file data.if any record out of 10 records is not success means i am not creating sales orders for total text file data.
    My error log file as
    file name,date time,total no of records,error record no,error description.
    one more text file as
    file name,date time,total no of records,succesful records , error records.
    I am getting these all data into my one more internal table.
    I am appending all data into my internal table.
    so i want retrieve only last row of data from that internal table.pls guide me how to get last row from the internal table.
    these text files i have to send to my user mail id directly when i am executing the program.
    any one knows the any function modules to send that text files to perticular mails.pls send the FM's to me.
    Regards,
    lokesh.

    hi
    good
    go through this report,hope help you to solve your problem
    report y_cr17_mail.
    data method1 like sy-ucomm.
    data g_user like soudnamei1.
    data g_user_data like soudatai1.
    data g_owner like soud-usrnam.
    data g_receipients like soos1 occurs 0 with header line.
    data g_document like sood4 .
    data g_header like sood2.
    data g_folmam like sofm2.
    data g_objcnt like soli occurs 0 with header line.
    data g_objhead like soli occurs 0 with header line.
    data g_objpara  like selc occurs 0 with header line.
    data g_objparb  like soop1 occurs 0 with header line.
    data g_attachments like sood5 occurs 0 with header line.
    data g_references like soxrl occurs 0 with header line.
    data g_authority like sofa-usracc.
    data g_ref_document like sood4.
    data g_new_parent like soodk.
    data: begin of g_files occurs 10 ,
      text(4096) type c,
       end of g_files.
    data : fold_number(12) type c,
           fold_yr(2) type c,
           fold_type(3) type c.
    parameters ws_file(4096) type c default 'c:\debugger.txt'.
    Can me any file fromyour pc ....either xls or word or ppt etc ...
    g_user-sapname = sy-uname.
    call function 'SO_USER_READ_API1'
    exporting
       user                            = g_user
       PREPARE_FOR_FOLDER_ACCESS       = ' '
    importing
       user_data                       = g_user_data
    EXCEPTIONS
       USER_NOT_EXIST                  = 1
       PARAMETER_ERROR                 = 2
       X_ERROR                         = 3
       OTHERS                          = 4
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    fold_type = g_user_data-outboxfol+0(3).
    fold_yr = g_user_data-outboxfol+3(2).
    fold_number =  g_user_data-outboxfol+5(12).
    clear g_files.
    refresh : g_objcnt,
      g_objhead,
      g_objpara,
      g_objparb,
      g_receipients,
      g_attachments,
      g_references,
      g_files.
    method1 = 'SAVE'.
    g_document-foltp  = fold_type.
    g_document-folyr   = fold_yr.
    g_document-folno   = fold_number.
    g_document-objtp   = g_user_data-object_typ.
    *g_document-OBJYR   = '27'.
    *g_document-OBJNO   = '000000002365'.
    *g_document-OBJNAM = 'MESSAGE'.
    g_document-objdes   = 'sap-img.com testing by program'.
    g_document-folrg   = 'O'.
    *g_document-okcode   = 'CHNG'.
    g_document-objlen = '0'.
    g_document-file_ext = 'TXT'.
    g_header-objdes =  'sap-img.com testing by program'.
    g_header-file_ext = 'TXT'.
    call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
      exporting
        method             = method1
       office_user        = sy-uname
       ref_document       = g_ref_document
       new_parent         =  g_new_parent
    importing
       authority          =  g_authority
    tables
       objcont            = g_objcnt
       objhead            = g_objhead
       objpara            = g_objpara
       objparb            = g_objparb
       recipients         = g_receipients
       attachments        = g_attachments
       references         = g_references
       files              = g_files
      changing
        document           = g_document
       header_data        = g_header
      FOLMEM_DATA        =
      RECEIVE_DATA       =
    File from the pc to send...
    method1 = 'ATTCREATEFROMPC'.
    g_files-text = ws_file.
    append g_files.
    call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
      exporting
        method             = method1
       office_user        = g_owner
       ref_document       = g_ref_document
       new_parent         =  g_new_parent
    importing
       authority          =  g_authority
    tables
       objcont            = g_objcnt
       objhead            = g_objhead
       objpara            = g_objpara
       objparb            = g_objparb
       recipients         = g_receipients
       attachments        = g_attachments
       references         = g_references
       files              = g_files
      changing
        document           = g_document
       header_data        = g_header
    method1 = 'SEND'.
    g_receipients-recnam = 'MK085'.
    g_receipients-recesc = 'B'.
    g_receipients-sndex = 'X'.
    append  g_receipients.
    call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
      exporting
        method             = method1
       office_user        = g_owner
       ref_document       = g_ref_document
       new_parent         =  g_new_parent
    importing
       authority          =  g_authority
    tables
       objcont            = g_objcnt
       objhead            = g_objhead
       objpara            = g_objpara
       objparb            = g_objparb
       recipients         = g_receipients
       attachments        = g_attachments
       references         = g_references
       files              = g_files
      changing
        document           = g_document
       header_data        = g_header.
    *-- End of Program
    thanks
    mrutyun^

  • BDC is not working in when executing the program in background

    Hi gurus,
    I have a problem that in BDC is not working when i'm executing the upload program in background thru scheduling(SM36) , while it works fine when i execute directly with NO screen display mode

    Many transactions behave differently when executed in foreground and background. The fields on the screen may be different.
    In transaction SHBD when starting a recording there is a checkbox where you can select 'Simulate Background Mode'. If you do your recording using this option you will get the code suitable for background mode. If you do not select this option you will get a code for foreground mode.
    By compairing the two codes you will know the changes required for background mode.
    Hope this helps you

  • Error when executing the program RBDMIDOC with Message type HRMD_ABA

    Hello All
    I finished the integration between CRM and HR
    Now I am able to replicate the employees and the organizations, but when I created a schedule job for the program RBDMIDOC and message type HRMD_ABA the system gives me warning and message: no data selected for distribution even if I try to run the program using SE38 I am getting the same error message
    I already activated the message type using BD50 and activated the Change pointers using BD61
    Regards
    Jacopo Fransoice

    us the program
    RHALEINI

  • Query taking lot of time to execute..

    Hi,
    I have a very complecated query which I am executing using JDBC. The query has an insert statement. This query takes 15 mins to complete. I'm running the query as stand alone java program. Can some one have some suggestions what is the best way to debug. I need to find out why the query is taking that long. I'm using oracle 10g with sql developer.
    ps = con.prepareStatement(query);
    ps.setString(1,date);
    ps.setString(2,code);
    timeStart = System.currentTimeMillis();
    ps.executeUpdate();
    timeEnd = System.currentTimeMillis();     
    System.out.println("Time Taken::"+(timeStart -timeEnd)+" ms");
    Thanks in advance
    Ajoo

    Perhaps you should post the query so we can see what you are doing.
    In the mean time, try writing a simple update query and run it. If it runs quickly, your original query has problems. If it runs slow, its caused by something other than your original query.
    P.S.:
    should be:
    System.out.println("Time Taken::"(timeEnd -timeStart)" ms");
    and not this:
    System.out.println("Time Taken::"(timeStart -timeEnd)" ms");
    Edited by: njbt7y on Jan 19, 2011 12:07 PM

  • DB fetch is taking lot of time

    Hi all,
    Iam doing a select from a view COVP (COEP + COBK tables) view is having more than 2crore records . my select stmt is taking more than 15 minutes. I need to reduce the fectching time .
    SELECT gjahr   "Fiscal Year
                 versn   "Production version
                 werks   " Plant
                 kstar   " Cost element
                 perio   " Period
                 wtgbtr  " Cost in USD
                 mbgbtr  " Cost in Hours
                 objnr   " Object Number
                 twaer   " Transaction currency
                 meinh   " Unit of measure
                 parob   " Partner Object
                 FROM covp APPENDING TABLE it_covp PACKAGE SIZE 5000
                 WHERE kokrs = p_kokrs AND
                 wrttp IN ('04' ,'11') AND
               ( perio >= p_fper AND perio <= p_tper ) AND
                 gjahr = p_gjahr AND
                 versn = p_versn AND
                 kstar IN s_kstar AND
                 parob IN r_objnr AND
                 werks IN s_werks.
        ENDSELECT.

    hi,
    you can use open cursor to fetch such large number of records and it will reduce the time and its very performnace effective.
    a sample code is  :
    Selection using open cursor
      DATA: LWA_OP_SAL_ORD1 TYPE GT_COMTAB.
      IF SY-SUBRC = 0.
        OPEN CURSOR C1 FOR
          SELECT VBAP~MATNR
          FROM VBAP INNER JOIN VBAK
          ON VBAPVBELN EQ VBAKVBELN
          FOR ALL ENTRIES IN GIT_VBUK
          WHERE VBAP~VBELN = GIT_VBUK-VBELN AND
                VBAK~VBTYP = 'C'.
        DO.
          CLEAR LWA_OP_SAL_ORD1.
          FETCH NEXT CURSOR C1 INTO CORRESPONDING FIELDS OF LWA_OP_SAL_ORD1.
          IF SY-SUBRC = 0.
            APPEND LWA_OP_SAL_ORD1 TO LI_OP_SAL_OR
    enddo.
    i think this will help.

  • I have LR6 running on a Windows machine.  Several times when launching the program I'm prompted as if I'm running a trial version, and then have to click a button to register and re-enter my license number.  This is getting tedious--what's going on Adobe?

    Please rush getting the first patch of updates out--I'm expecting a finished product, not a "beta" version.  I don't mind beta testing, but not AFTER I've purchased an upgrade!!

    You do not have the properties in the Bookmarks Manager (Library), but you should have it if you right-click a bookmark the Bookmarks Toolbar or in the bookmarks sidebar.
    On Mac you probably do not have it if you right-click an item in the Bookmarks menu (this menu is under control of the Mac OS), but I assume that this should work if you click the "Show your bookmarks" button on the Navigation Toolbar that is next to the star to bookmark the current tab and right-click an item in the bookmarks list that opens.

  • Script Logic taking a lot of time to execute

    Hi,
       I have a script logic which does the currency translation
    But it takes a lot of time to execute the same. can anyone suggest me to write a effective script logic to reduce the
    performance .
    I am using the input schedule that uses the script logic to execute with 6000 records.
    below is the script logic
    *LOOKUP RATE
       *DIM R_ACCT=[ACCOUNT].RATETYPE
       *DIM FX_LC1:R_CURRENCY ="LC1"
       *DIM FX_LC2:R_CURRENCY ="LC2"
       *DIM FX_LC3:R_CURRENCY ="LC3"
       *DIM FX_LC4:R_CURRENCY ="LC4"
       *DIM FX_LRC:R_CURRENCY ="LRC"
       *DIM R_ENTITY                     =GLOBAL
       *DIM SCENARIO                   =[SCENARIO]
       *DIM TIME                            =[TIME]
    *ENDLOOKUP
    *WHEN ACCOUNT.RATETYPE
    *IS "AVG","END"
       //TRANSLATE
       *WHEN CURRENCY
       *IS LC1
           *WHEN COMPANY.LC1
           *IS <> "NUL"
                *REC(FACTOR=LOOKUP(FX_LC1),CURRENCY=USD)
                *REC(FACTOR=LOOKUP(FX_LC1)/LOOKUP(FX_LRC),CURRENCY=LRC)
           *ENDWHEN
       *IS LC2
           *WHEN COMPANY.LC2
           *IS <> "NUL"
                *REC(FACTOR=LOOKUP(FX_LC2),CURRENCY=USD)
                *REC(FACTOR=LOOKUP(FX_LC2)/LOOKUP(FX_LRC),CURRENCY=LRC)
           *ENDWHEN
       *IS LC3
            *WHEN COMPANY.LC3
            *IS <> "NUL"
                *REC(FACTOR=LOOKUP(FX_LC3),CURRENCY=USD)
                *REC(FACTOR=LOOKUP(FX_LC3)/LOOKUP(FX_LRC),CURRENCY=LRC)
            *ENDWHEN
       *IS LC4
            *WHEN COMPANY.LC4
            *IS <> "NUL"
                 *REC(FACTOR=LOOKUP(FX_LC4),CURRENCY=USD)
                 *REC(FACTOR=LOOKUP(FX_LC4)/LOOKUP(FX_LRC),CURRENCY=LRC)
            *ENDWHEN
       *IS LC_USD
          *REC(FACTOR=1,CURRENCY=USD)
          *REC(FACTOR=1/LOOKUP(FX_LRC),CURRENCY=LRC)
       *ENDWHEN
    *ENDWHEN
    *COMMIT
    Kindly help as soon as possbile
    Edited by: Deepak_Hegde on Feb 2, 2012 4:58 PM

    Why wouldn't you use standard functionality with *RUN_PROGRAM CURR_CONVERSION?
    You'll have to call it multiple times since you want to translate into different currencies, but I think it will still be faster than this script.

  • Comma Separated Value Taking too Much Time to Execute

    Hi,
    select ES_DIAGNOSIS_CODE DC from ecg_study WHERE PS_PROTOCOL_ID LIKE 'H6L-MC-LFAN'
    The above query returns comma separated value from the above query.
    I am using the query below to split the comma separated value but the below query is taking lot of time to return the data.
    SELECT
    select DC from (
    with t as ( select ES_DIAGNOSIS_CODE DC from ecg_study WHERE PS_PROTOCOL_ID LIKE 'H6L-MC-LFAN' )
    select REGEXP_SUBSTR (DC, '[^,]+', 1, level) DC from t
    connect by level <= length(regexp_replace(DC,'[^,]*'))+1 )
    Please suggest me is there any alternative way to do this comma separated value.
    Thanks
    Sudhir

    Nikolay Savvinov wrote:
    Hi BluShadow,
    I know that this function is fast with varchar2 strings from several years of using it. With CLOBs one may need something faster, but the OP didn't menion CLOBs.
    Best regards,
    NikolayJust because you perceive it to be fast doesn't mean it's faster than doing it in SQL alone.
    For starters you are context switching from the SQL engine to PL/SQL to call it.
    Then in your code you are doing this...
    select substr(v_str,v_last_break+1, decode(v_nxt_break,0,v_length, v_nxt_break-v_last_break-1)) into v_result from dual;which is context switching back from the PL/SQL engine to the SQL engine for each entry in the string.
    Why people do that I don't know... when PL/SQL alone could do it without a context switch e.g.
    v_result := substr(v_str,v_last_break+1, case when v_nxt_break = 0 then v_length else v_nxt_break-v_last_break-1 end);So, if you still think it's faster than pure SQL (which is what the OP is using), please go ahead and prove it to us.

  • Premiere Pro crashes when opening the program. what to do

    Premiere Pro crashes every time when opening the program. Other creative cloud programs are functioning well. What to do?

    You may get more specific help in that forum http://forums.adobe.com/community/premiere
    When you go there, you need to provide a LOT more information for anyone to help
    -PPro Information FAQ http://forums.adobe.com/message/4200840
    Also, Go to http://forums.adobe.com/community/premiere and, in the area just under Ask a Question, type in
    crash on launch
    You may now read previous discussions on this subject... be sure to click the See More Results at the bottom of the initial, short list if the initial list does not answer your question

  • Select Command taking a lot of time to execute

    Dear Experts,
    My below SELECT command taking a lot of time to execute.
          SELECT wid
                       matl_desc
                       INTO TABLE open_wid FROM zwb_table
                       WHERE ( weight2 = 0 OR weight2 IS NULL ).
    Table : zwb_table contains around 7 Lacs records. That's why taking a lot of time . I have also Indexed the table zwb_table with field WID & WEIGHT2 . (zwb_table contains only WID as Primary Key Field)
    Structure of Internal Table : open_wid ->
                                             wid LIKE zwb_table-wid,
                                             matl_desc LIKE zwb_table-matl_desc,
    Please suggest me how to Improve the Performance of the above Select command.
    Thanks in Advance
    JACK

    Hi Jack,
    you are having morethan 7lack records in z table. it is not good practice fetching all the records into internal table and restricting with where clause in loop statement.
    I hope you already created secondary index combination of primary key.
    check you select query fetching records based on index you have created in ST05.
    Refer below link for your program is using index that you have created.
    Re: Indexing
    Regards,
    Peranandam
    Edited by: peranandam chinnathambi on Apr 7, 2009 8:38 AM

  • Background task taking a lot of time to execute

    Hi,
    There is a background task in my workflow which is taking a lot of time to execute.
    I have tested it in dialog mode.. and it works fine.. takes just 2 mins.
    Only when the task is executed from background.. it takes about 10 mins.
    Is this a config problem? How do I check if it is so?

    you could try activating a trace (sql) and see what the differences are,.
    you could check if maybe user parameters are influencing this. Or ask your basis team if there are a lot of differences between syystem users and dialog users in terms of resource allocation.
    Did you find anything different whilst debugging it?
    Kind regards, Rob Dielemans

  • Select query is taking lot of time to fetch data.....

    Select query is taking lot of time to fetch data.
        SELECT algnum atanum  abdatu abzeit abname abenum bmatnr bmaktx bqdatu bqzeit bvlenr bnlenr bvltyp bvlber b~vlpla
               bnltyp bnlber bnlpla bvsola b~vorga INTO TABLE it_final FROM ltak AS a
                       INNER JOIN ltap AS b ON  btanum EQ atanum AND algnum EQ blgnum
                       WHERE a~lgnum = p_whno
                       AND a~tanum IN s_tono
                       AND a~bdatu IN s_tocd
                       AND a~bzeit IN s_bzeit
                       AND a~bname IN s_uname
                       AND a~betyp = 'P'
                       AND b~matnr IN s_mno
                       AND b~vorga <> 'ST'.
    Moderator message: Please Read before Posting in the Performance and Tuning Forum
    Edited by: Thomas Zloch on Mar 27, 2011 12:05 PM

    Hi Shiva,
    I am using two more select queries with the same manner ....
    here are the other two select query :
    ***************1************************
    SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
        FROM ztftelpt LEFT JOIN ztfzberep
         ON  ztfzberep~gjahr = st_input-gjahr
         AND ztfzberep~poper = st_input-poper
         AND ztfzberepcntr  = ztftelptrprctr
        WHERE rldnr  = c_telstra_projects
          AND rrcty  = c_actual
          AND rvers  = c_ver_001
          AND rbukrs = st_input-bukrs
          AND racct  = st_input-saknr
          AND ryear  = st_input-gjahr
          and rzzlstar in r_lstar             
          AND rpmax  = c_max_period.
    and the second one is
    *************************2************************
      SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
        FROM ztftelnt LEFT JOIN ztfzberep
         ON  ztfzberep~gjahr = st_input-gjahr
         AND ztfzberep~poper = st_input-poper
         AND ztfzberepcntr  = ztftelntrprctr
        WHERE rldnr  = c_telstra_networks
          AND rrcty  = c_actual
          AND rvers  = c_ver_001
          AND rbukrs = st_input-bukrs
          AND racct  = st_input-saknr
          AND ryear  = st_input-gjahr
          and rzzlstar in r_lstar                              
          AND rpmax  = c_max_period.
    for both the above table program is taking very less time .... although both the table used in above queries have similar amount of data. And i can not remove the APPENDING CORRESPONDING. because i have to append the data after fetching from the tables.  if i will not use it will delete all the data fetched earlier.
    Thanks on advanced......
    Sourabh

Maybe you are looking for

  • SOS: Display data in Web DynPro table from database via EJB.

    i build two views : queryView and displayView! displayView: is used to display all query result in the table;these data is bind to a commandBean model(javaBean imported). queryView:   is used to full in different query conditions,then u can pressed a

  • How to use CSV format in making a data connection.

    Hello All, I have got a form to develop. There are over 1000 entries to be imported. Can I use CSV format to embed those data in the forms. Mainly those data would be embedded as dropdowns.If I can use how to do it ? If i can not use is there any bet

  • Can I use IPhone 5s of Hong Kong in India??

    i live in india and I have purchased a iPhone 5s of hong kong and want use it in india can i use it??????

  • Updating  data

    Hi , 137/234 Tob 13% Che 98.5F Crt 10*6 Rad How could i Update the above data in a field to get values as below 137/234 13% 98.5F 10*6 Thanks for the help

  • Cancel Assignment from ACC

    Hi all, Could someone say to me if is possible to cancel the assignment of a DIR from own Standard Contest? If not, why? are there thecnical reason or logical reason behind? Because, I'm imagine that after some years, inside context will be a lot of