Performance of sap query

Hi All
I have one SAP query which collects data from VBRK, VBUK, VBPA,, VBRP, VBFA and KONV tables.
Some times it is taking a lot of time.
How can I improve the performance of this query.

hi,
You can get by using the JOIN's in the query, please take care of these
1, promary index and secondary index.
2, don't join all the table, split them into different queries..bu using FOR ALL ENTRIES
3. give where conditions as many as possible..
4. Sort the result finally..
hope this will help u.
Pradeep

Similar Messages

  • SAP Query - Modfication/Changes

    Hi Experts,
    I am new SAP Query, so i have come up with this issue. Please help.
    I have an infoset query with me, also a SAP query and a transaction with some Z transaction code, the program name as taken from System->Status is AQZZZSD=========Z_SD_ORD_WO_ST.
    1. Now I can see code in the program, but I cant see that much of code in the SQ02 under extras tab. 
    2. Moreover, I have to change the code to address new requirements. How can I change the code in a SAP query???
    What are the ways to change an existing SAP query's code ???
    Thanks,
    Chandan

    Hi Chandan,
    Go to Infoset (SQ02) in change mode, click on Code icon (Sfift + F8) displayed on Application bar.
    You will find, 'Code section' where different events are listed. You can write your code in any of listed events depending on your need.
    For ex. if you want declare any variable in u2018DATAu2019 Section, to initialize any variable can use INITIALIZATION event.
    If you want to perform operation on selection screen you can use 'AT SELECTION-SCREEN OUTPUT'
    And most important event for this tool is Record Processing event like if you want to have any condition and calculation or modification of field value, you can write code in this event.
    END OF SELECTION BEFORE LIST--> You can write header information in this event. After this information, your output is displayed. (User WRITE statement to write your information)
    END OF SELECTION AFTER LIST--> You can write footer information in this event. After query output, information mentioned in this event is displayed.
    Note: END OF SELECTION BEFORE LIST and END OF SELECTION AFTER LIST work only when output format of your query (SQ01) is u2018ABAP LIST'
    GET and GET LATE: When you select a logical database as a data source of an infoset, you get this additional event to maintain the code as per your need for LDB.
    Please let me know if you need any further details.
    Regards,
    Dinesh
    Edited by: Dinesh Tiwari on Sep 30, 2009 7:21 AM

  • Is it possible to use aggregation function in SQ Sap query?

    I need to create a sap query like using SELECT MAX(begda) statement.
    Please teach me how...
    Thank u in advance..

    Hi Ella,
    You can very well use the aggregate functions in sql which is usually a performance tuning technique.
    A calculation that is made on several records or cells of data. SUM, AVG, MAX, MIN and COUNT are examples of aggregate functions that are used in spreadsheets and database programs.
    SELECT ( ( ] ...
    MAX: returns the maximum value of the column
    MIN: returns the minimum value of the column
    AVG: returns the average value of the column
    SUM: returns the sum value of the column
    COUNT: counts values or lines as follows:
    · COUNT( DISTINCT ) returns the number of different values in the column.
    · COUNT( * ) returns the total number of lines in the selection.
    Ex:    DATA: fldate LIKE sbook-fldate,
          count  TYPE i,
          avg    TYPE p DECIMALS 2,
          max    TYPE p DECIMALS 2.
    SELECT fldate COUNT( * ) AVG( luggweight ) MAX( luggweight )
           FROM sbook
           INTO (fldate, count, avg, max)
           WHERE carrid = 'LH' AND
                 connid = '0400'
           GROUP BY fldate.
      WRITE: / fldate, count, avg, max.
    ENDSELECT.
    For further info:
    http://help.sap.com/saphelp_nw04/helpdata/EN/fc/eb3990358411d1829f0000e829fbfe/content.htm
    http://help.sap.com/abapdocu/en/ABAPSELECT_AGGREGATE.htm
    Thanks and Regards
    Srikant.P
    Edited by: SRIKANTH P on May 27, 2009 9:41 AM

  • VC and SAP Query

    <u><b>System Landscape</b></u>
    NW Sneak Preview Java Edition with EP 6.0 (from SDN)
    VC 6.0, Patch 5
    R/3 Enterprise 4.7 extension set 200 (WAS 6.20)
    <u><b>Scenario</b></u>
    Utilize the BI Kit in VC and use SAP Query from a backend R/3 system to generate VC content.
    <i>(From what I have understood, the BI Kit does not necessarily need BW and can work with a R/3 source)</i>
    <u><b>Questions</b></u>
    (a) Is the assumption correct that the BI Kit can use the SAP Query as a backend to generate content in VC (without a BW system in the landscape)?
    (b) Do I need to install the BI UDI SP stack with the EP in NetWeaver Sneak Preview ?
    (c) What type of systems do I need in the EP ? If I try the "New System" wizard, I do not get an option to connect to a "BI" system. nevertheless, if i try "new from PAR", i have a an option to use "com.sap.portal.systems.BIUDI". Can you help me with the parameters for a PAR - "com.sap.portal.systems.BIUDI" ?
    any other tips / experiences of working with SAP Query and VC are most welcome.
    Regards, Parag.
    Note: I have tried a R/3 system connection and the RFCs are visible in VC

    Thanks a ton Mario, your hints helped me in arriving at the configuration.
    For the sake of completeness, I am listing the steps that led me to a successful config.
    1. Download the BW 3.5 SR1 installation guide from service marketplace
    2. Goto section 6 and perform the steps highlighted for BI Query Connector. Note that if you dont assign a value for the parameter "SERVERGROUP", the default is PUBLIC. So if you have a server with only SPACE (like I had), please do enter "SPACE" for this property.
    3. Edit the services file on the Windows Server and add an entry for your SAP server. For example, my server SID is DEV, hence I inserted the following entry in the service file: sapmsDEV 3600/tcp
    This step is necessary for JCo to work.
    4. Stop and Re-start the BI Query service (using the Visual Administrator)
    5. Test the connection with the following URL - http://<host>:<port>/TSapq/servlet/TestSapq
    This should list you the queries in the SAP system
    6. Open EP (I logged in as admin) and add the system as described in Step 4, section 2.2 of the VC installation guide.
    7. Add permission for "everyone" group to this system
    8. Login to EP with another userid, perform user mapping (personalize option)
    9. Start VC storyboard, login to EP with the other userid (not admin), use Data Service or BI Query Wizard to retreive the queries.
    Why did I have to use another userid ?
    Well, this was because the connection test did not work for me with the admin user, nor was I able to retrieve the queries in VC. Dont know why this didnt work.
    Message was edited by: Parag Jain

  • Infoset data grouping for SAP Query

    Hi,
    I'm pretty new to SAP R/3 (4.7) and have a query that I think relates to Infoset rather that SAP Query.
    I have two tables to join but the right hand table (it's a left outer join), needs to be summarised to reduce to unique records on each side of the join. In SQL Plus I would use a 'Group by' to perform this function .. is there a simple way to do this when building the Infoset ?
    I am not an ABAP programmer, nor do I have access to ABAP so would prefer not to go down this route unless it's the only way.
    Any assistance would be appreciated.

    Hi Guys,
    Any ideas?

  • How to override security for table access when using SAP Query?

    We have a number of infosets which use table join between PA0001 and CATSDB table. To execute a query based on such a query you would need access to table auth group PA through S_TABU_DIS. This was earlier not a problem as SAP query was earlier used by support staff and not end users. We do not want to give S_TABU_DIS with to end users as this amounts to givin them access to all PA tables.
    The generated code for the query checks for the condition
    "%rtmode-no_authchk = space"
    before going for the authorization check.
    Thus, ideally the authorization check for an InfoSet can be skipped if we can pass X for this variable from the InfoSet definition. Is there a way to do this?
    Would appreciste any inputs to help suppress the authorization check at this point. Thanks.....

    >
    Julius Bussche wrote:
    > Perhaps you could replace it with a class of your own (transaction SE24)?
    >
    > I have not tried to do this; it was just a thought.
    >
    > Kind regards,
    > Julius
    unfortunately this does not work. SAP saw fit to 'hard-code' the implementation of the interface in RSAQEXCE:
    (only parts of that abap displayed here).
    170 data: iref type ref to if_query_tab_access_authority.
    1107 *       FORM AUTHORITY_BEGIN
    1112 form authority_begin using p_auth_classname type AQS_CLSNA.
    1119   perform authority_init using p_auth_classname.
    1120   call method iref->access_authority_begin.
    well for my part (searching a solution for a query on LTAK, wanting L_LGNUM as an object) i'm out of ideas. i shall have to modify SAP-standard and disable the class and do my own coding in the info-set. no other possibility - i cannot allow S_TABU_DIS for group LA and even if i did, what help would it be - i would have to allow that to all companies in that client having WM - and that would be literally all - i need LGNUM here!

  • Using SAP Query Extractor for GLPCA

    Hi, We are considering to use SAP Query to extract GLPCA data so that we can retrieve some additional information.   We are doing this because we need to check BSEG for a Material Number and replace Material in GLPCA it if it's different than the one in GLPCA.
    How can the SAP Query be used to perform the required delta?  Example: using CPUDATE and Time?
    Any help with this is greatly apprectiated.
    Thanks,

    Decided not to use SAP Query.

  • Performance of the query is poor

    Hi All,
    This is Prasad.  I have a problem with the query it is taking more time to retrieve the data from the Cube.  In the query they are using a Variable of type Customer Exit.   The Cube is not at compressed.  I think the issue with the F fact table is due to the high number of table partitions (requests) that it has to select from. If I compress the cube, the performance of the query is increased r not?  Is there any alternative for improving the performance of the query.  Somebody suggested Result set query, iam not aware of this technique if u know let me know.
    Thanks in advance

    Hi Prasad,
    Query performance will depend on many factors like
    1. Aggregates
    2. Compression of requests
    3. Query read mode setting
    4. Cache memory setting
    5. By Creating BI Accelerator Indexes on Infocubes
    6. Indexes
    Proposing aggregates to improve query performance:
    First try to execute the query in RSRT on which u required to build aggregates. Check how much time it is taking to execute.....and whether it is required to build aggregate on this querry?? To get this information, Goto SE11> Give tabl name RSDDSTAT_DM in BI7.0 or RSDDSTAT in BW3.x.> Disply -> Contnts-> Give from date and to date values as today, user name as Ur user name, and give the query name
    --> execute.
    Now u'll get a list with fields like Object anme(Report anme), Time read, Infoprovider name(Multiprovider), Partprovider name (Cube), Aggregate name... etc. If the time read is less than 100,000,000 (100 sec) is acceptable. If the time read is more than 100 sec then it is recommended to create Aggregates for that query to increase performance. Keep in mind this time read.
    Again goto RSRT> Give query name> Execute+Debug-->
    A popup will come in that select the check box display aggregates found--> continue. If any aggregates or exist for that
    query it will display first if u press on continue button, it will display from which cube which fields are coming it will display...try to copy this list of objects on which aggregate can be created into one text file...
    then select that particular cube in RSA1>context>Maintain Aggregates-> Create by own> click on create aggregate button on top left side> Give discription of the aggregate>continue> take first object from list and fclick on find button in aggregates creation screen> give the object name and search... drag and drop that object into aggregate name right side (Drag and drop all the fields like this into aggregate).---->
    Activate the aggregate--> it will take some time once the activation finishes --> make sure that aggregate is in switch on mode.
    Try to xecute the query from RSRT again and find out the time read and compare this with first time read. If it is less tahn first time read then u can propose this aggregate to incraese the performance of the query.
    I hope this will help u... go through the below links to know about aggregates more clear.
    http://help.sap.com/saphelp_nw04s/helpdata/en/10/244538780fc80de10000009b38f842/frameset.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3f66ba90-0201-0010-ac8d-b61d8fd9abe9
    Follow this thread for creation of BIA Indexes:
    Re: BIA Creation
    Hopr this helps...
    Regards,
    Ramki.

  • Need ur valuable suggestions on performance in sap BI

    Hi All,
    Hope every one is doing great. Need ur valuable suggestions on performance in SAP BI.
    1. what is meant by DB partitioning, in which scenario we use it and what the steps to do this task.
    2. Navigational attributes are use when v want to make use of this attr in reporting with certian actions. My question is do navigational attributes improves the performance if so how and if not what are the draw backs.
    3. Multiprovider are use to access the data from different infoprovider to generate the reports.
    In what way multiprovider inproves the performance??
    4. Number Range buffering when it is used what r the steps has to follow ??
    5. what is the procedure to calculate the DB statistics. what are the technical conents v install for this, when we install this befor the development are after completion of the developement and   in what way they are helpfull to measure the performance.
    Thanks in Advance
    KK

    1. what is meant by DB partitioning, in which scenario we use it and what the steps to do this task.
    http://help.sap.com/saphelp_nw70/helpdata/en/33/dc2038aa3bcd23e10000009b38f8cf/content.htm
    2. Navigational attributes are use when v want to make use of this attr in reporting with certian actions. My question is do navigational attributes improves the performance if so how and if not what are the draw backs.
    Nav Attribute:-
    The dataflow performance/space is affected in the infoobject load, since the sid tables is growing with navigational attributes
    The dataflow performance/space is not affected in transactional data (except for the aggregates).
    So every navigationa attribute in an infoobject can be added to the infocubes without any cost.
    The performance in query is affected, but the solution is simple: do not use!
    Please check the following thread:
    Re: Navigate Attribute
    3. Multiprovider are use to access the data from different infoprovider to generate the reports.
    In what way multiprovider inproves the performance??
    --THis causes performance degradation as OLAP has to divide the query in many sub-queries.
    4. Number Range buffering when it is used what r the steps has to follow ??
    5. what is the procedure to calculate the DB statistics. what are the technical conents v install for this, when we install this befor the development are after completion of the developement and in what way they are helpfull to measure the performance.
    --For DB Statistics :
    Ref : SAP Note No: 588668
    http://help.sap.com/saphelp_nw04/helpdata/en/19/f832ac5d4611d4aa1500a0c9430730/content.htm

  • SAP Query Use and Transport Strategy

    Anyone wish to share their experience in the use of SAP Query?  We generally have an understanding that we don't want to be giving out this tool to end-users in Production.  We would like to create queries, and when we wish to give them out we'll attach t-codes to them and roll them out.
    However in practice, this is becoming difficult.  An example is where in our gold client we create queries and then we would typically transport to our unit test client.  But whenever we do an export, it generates a transport request.  Before we are done testing we may end up with 10's of transports for a single query?
    Anyone have some ideas on a transport strategy for SAP Query?  How about it's use in Production?  Our landscape for changes are typically DEV Gold -> DEV Test -> QAS -> PRD.  We would ideally like our transport strategy for queries to match what we do for everything else.

    HI,
    Query objects are transported in different ways according to the query area in which they were created.
    In order to know which transport options are available, you must first understand how query objects are created.
    <b>Standard Area</b>
    Query objects are stored in the client-specific table AQLDB. They are not connected to the Change and Transport Organizer.
    <b>Global Area</b>
    Query objects are stored in the cross-client table AQGDB. They are connected to the Change and Transport Organizer.
    http://help.sap.com/saphelp_47x200/helpdata/en/d2/cb467f455611d189710000e8322d00/content.htm
    Global area objects can be transported into other systems. Standard area query objects can not only be transported to other clients within their own system, but into all clients of other systems as well. In addition, query objects can be transported from the global query area to the standard query area and back within the same system.Transports are normally performed by the system administrator, not by end-users. For this reason, you need the appropriate authorizations
    Check the below links for detailed explanation
    <b>Transporting Global Area Objects</b>
    http://help.sap.com/saphelp_47x200/helpdata/en/ec/052786a30411d1950a0000e82de14a/content.htm
    <b>Transporting Standard Area Objects</b>
    http://help.sap.com/saphelp_47x200/helpdata/en/ec/052789a30411d1950a0000e82de14a/content.htm
    <b>General Transport Description</b>
    http://help.sap.com/saphelp_47x200/helpdata/en/d2/cb4699455611d189710000e8322d00/content.htm
    <b>Generating Transporting Datasets</b>
    http://help.sap.com/saphelp_47x200/helpdata/en/d2/cb46a6455611d189710000e8322d00/content.htm
    <b>Reading Transport Datasets</b>
    http://help.sap.com/saphelp_47x200/helpdata/en/d2/cb46e7455611d189710000e8322d00/content.htm
    <b>Managing Transport Datasets</b>
    http://help.sap.com/saphelp_47x200/helpdata/en/d2/cb46f4455611d189710000e8322d00/content.htm
    <b>Transporting Objects between Query Areas</b>
    http://help.sap.com/saphelp_47x200/helpdata/en/ec/05278ca30411d1950a0000e82de14a/content.htm
    I hope this solves your purpose.
    Regards,
    Vara
    Message was edited by:
            varaprasad bhagavatula

  • Performance Dialogue error - Query "Status Overview is already open in ano

    Hi All,
    We implemented ESS MSS on Portal 7.01 SP8. With With SAP_ESS 603 SP7 and BP_ERP5ESS 1.41 SP9
    This is for country Qatar and it has made as a copy of GB as SAP doesnt provide any country structure for Qatar.
    We are facing error in Performance Dialog saying "Query "Status Overview is already open in another session" when click / display button is clicked after selecting the Appriasal document in ESS.
    This is working fine for all other countries and also this works fine if another country's portal role is assigned to same PRNR or test user.
    We cant see any locks in backend / portal.
    Please can someone help.

    Hi Siddharth,
    We have already checked and there were/are no locks in Sm12.
    I tried deleting the locks using the mentioned program, in result is does say that ! query found but when I go to Portal and open the Performance Dialogue document , I still get the error Query " " is already open in another session
    Note 1432358 is for  SAP_BASIS >= 701 which is suitable for our case but, just wanted to check, Performance dialogue works fine for all other countries and only for this particular country it's not working.
    We are able to replicate this in Development and Test, both the environments.
    Also, when this particular user is assigned, another country's portal roles the problem doesnt occur.
    Any clues?

  • Ways to improve the performance of my query?

    Hi all,
    I have created a multi provider which enables to fetch the data from 3 ods. And each ods contains huge amount of data. As a result my query performance is very slow..
    apart from creating indexes on ods? is there any other to be carried out to improve the performance of my query. Since all the 3 info providers are ods.
    thanxs
    haritha

    Haritha,
    If you still need more info, just have a look below:
    There are few ways your queries can be improved:
    1. Your Data volume in your InfoProviders.
    2. Dim table, how you have manage your objects into your dim table.
    3. Query that runs from multiprovider vs cube itself. when running from multiproviders at the time of execution the system has to create more tables hence the query performance will be affected.
    4. Aggregates into the cube, and they perfection of designing the aggregates.
    5. OLAPCHACHE
    6. Calculation formula
    etc.
    and also you can go thru the links below:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/cccad390-0201-0010-5093-fd9ec8157802
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/ce7fb368-0601-0010-64ba-fadc985a1f94
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/c8c4d794-0501-0010-a693-918a17e663cc
    Hope this helps you.
    ****Assign Points*******
    Gattu

  • Navigation to Transcation from SAP QUERY Reports

    Gurus
    Can we navigate to specific transaction codes by clicking on a field in a report developed using SAP QUERY, similar to HOT SPOTS we have in ABAP reports
    Thanks
    nithi A

    Dear ,
    FORM user_command USING r_ucomm TYPE sy-ucomm rs_selfield TYPE slis_selfield.
      DATA  : fieldnm(15) TYPE c .
      DATA   : v_para(15) TYPE c.
      DATA   : v_para1(15) TYPE c.
      CLEAR mt_fieldcat.
      CLEAR lt_fieldcat.
      CASE r_ucomm.
        WHEN 'SAVE'.
          PERFORM save.
        WHEN 'SELALL'.
          PERFORM select.
        WHEN 'DEALL'.
          PERFORM deselect.
        WHEN  '&F03' OR '&F12' OR '&F15'.
          LEAVE PROGRAM.
      ENDCASE.
      fieldnm = rs_selfield-fieldname.
      READ TABLE it_zmseg INDEX rs_selfield-tabindex.
      IF sy-subrc EQ 0.
        IF rs_selfield-fieldname = 'BISMT'.
          v_para = rs_selfield-value .
          submit "transaction name " exporting from memory  return .
      ENDIF.
      CLEAR v_para.
    check syntax of submit "taransaction .
    this will help you .
    Deepak Dhamat

  • Tcode to SAP Query

    Hi All,
    I have created a SAP Query and I have assigned a tcode in the dev Server, It is working fine in the Dvelopment But Throws a dump in the Quality and Production Server of Program not found and asks to create the program.
    The Program exists in se38 in the quality and Production Server and it works fine in the Devlopment Server.
    Nimisha Gandhi.

    Hi,
    1) set a break-point on:
    PERFORM load IN PROGRAM (i_s_prof_int-progname).
    and check which porgram-name is shown at runtime
    and search for this program and perform.
    if you don't find - create an oss-note
    what i can imagine - that it's a program, which should be generated at runtime - but wasn't gen. because of a syntax error!
    or
    try update debugging? Maybe this part is executed in an update task.
    Otherwise online/background version are really running different!
    or
    There is a dynamic call, which needs correct program in variable i_s_prof_int-progname.
    Obviously this is filled different (or not at all) in background run.
    Set a break-point and try to find out, how this field is filled. Maybe you get a hint, why this might be different in background
    Regards,
    Harini.S

  • Help required for improving performance of the Query

    Hello SAP Techies,
    I have MRP Query which shows Inventory projection by Calendar Year/Month wise.
    There are 2 variables Plant and Material in free charateristics where it has been restricted by replacement of Query result .
    Another query is Control M Query which is based on multiprovider. Multiprovider is created on 5 cubes.
    The Query is taking 20 -15 Mins to get the result.
    Due to replacement path by query result for the 2 variables first the control M Query is excuted. Business wanted to see all those materials in MRP query which are allocated to base plant hence they designed the query to use replacement Path by Query result. So it will get all the materials and plants from the control M query and will find the Invetory projection for the same selection in MRP query.
    Is there any way I can improve the performance of the Query.
    Query performance has been discussed innumerable times in the forums and there is a lot of information on the blogs and the WIKI - please search the forums before posting and if the existing posts do no answer your question satisfactorily then please raise a new post - else almost all the answers you get will be rehashed versions of previous posts ( and in most cases without attribution to the original author )
    Edited by: Arun Varadarajan on Apr 19, 2011 9:23 PM

    Hi ,
    Please see if you can make these changes currently to the report . It will help in improving the performance of the query
    1. Select the right read mode.
        Reading data during navigation minimizes the impact on
         the application server resources because only data that
        the user requires will be retrieved.
    2. Leverage filters as much as possible. Using filters contributes to
       reducing the number of database reads and the size of the result set,
        hereby significantly improving query runtimes.
       Filters are especially valuable when associated with u201Cbig
        dimensionsu201D where there is a large number of characteristics such as
        customers and document numbers.
    3. Reduce RKFs in the query to as few as possible. Also, define
    calculated & RKFs on the Infoprovider level instead of locally within the query.
    Regards
    Garima

Maybe you are looking for