Answer report is taking infinite time without returning results

Hi All,
We have an issue with one of our user. When she is trying to fetch some reports, its taking nearly 1 hr without returning any error and some time returning error.
Other user are able to fetch the same report.
Is it something to do with her system/computer or any Application related issue?
Thanks in Advance.
Regards
Sudipta

Hi sudipta,
It might be a network error or any error we cant say...First check the query retrieved by that user and run at the backend DB if its fast then look at the query for other users and compare it for any additional conditions coming into the SQL for that user and see how many records are fetching.This way we need to figure out the problem.
if not check the network connections or firewall that is hindering the performance of the query.
hope helps you.
Cheers,
KK

Similar Messages

  • Discoverer report is taking much time to open

    Hi
    All the discoverer report are taking much time to open,even query in lov is taking 20 -25 min.s.We have restart the services but on result found.
    Please suggest what can be done ,my application is on 12.0.6.
    Regards

    This topic was discussed many times in the forum before, please see old threads for details and for the docs you need to refer to -- https://forums.oracle.com/forums/search.jspa?threadID=&q=Discoverer+AND+Slow&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • Report is taking mofe time

    Hello Friends,
    I have created Multicube which is based on another 2 basic cubes.
    I have created aggreagtes on basic cube as well and it is supporting to some reports.
    Now the problem is - I have created one query which is based on Multicube and have selected filter with one
    field but now it is taking much time to execute that query.
    so please suggest me how i can increse the performance for the same.
    It will be nice help for me .
    Regards

    hi Jain,
    check if helps
    Note 869487 - Performance optimization for MultiCubes
    Note 449477 - Switching the MultiProvider from "parallel" to "sequential"

  • Materialized views with Complete refresh taking infinite time while refresh

    Hi,
    We have some materialized view which are configured for Complete refresh and are being refreshed manually everyday in the morning. Some times we face this issue of the MV taking longer time than usual for refresh. We tried running the below query to see if any object/MVs are locked and did not obtain any entries using the query:
    SELECT username U_NAME, owner OBJ_OWNER,
    object_name, object_type, s.osuser,
    DECODE(l.block,
    0, 'Not Blocking',
    1, 'Blocking',
    2, 'Global') STATUS,
    DECODE(v.locked_mode,
    0, 'None',
    1, 'Null',
    2, 'Row-S (SS)',
    3, 'Row-X (SX)',
    4, 'Share',
    5, 'S/Row-X (SSX)',
    6, 'Exclusive', TO_CHAR(lmode)
    ) MODE_HELD
    FROM gv$locked_object v, dba_objects d,
    gv$lock l, gv$session s
    WHERE v.object_id = d.object_id
    AND (v.object_id = l.id1)
    AND v.session_id = s.sid
    ORDER BY username, session_id;
    Hence please help us in troubleshooting this issue in Refreshing. and also let us know of any possible cause of Refresh taking longer time than usual.
    Thanking you in advance.
    Bharath

    >
    We have some materialized view which are configured for Complete refresh and are being refreshed manually everyday in the morning. Some times we face this issue of the MV taking longer time than usual for refresh
    >
    Which is it? 'some' MVs or 'the' MV that is taking longer than usual.
    1. How many MVs are being refreshed?
    2. What process are you using to refresh them
    3. Are you refreshing them one at a time serially or just starting the refresh of all of them at the same time?
    4. Do any of these MVs use the same base tables as the other MVs
    5. Are any of the MVs based on remote tables?
    6. Are any of the MVs based on other MVs?
    7. What does an AWR report show for the time period when things are taking longer than usual?
    All of the same issues that can cause a query to run slow can cause an MV refresh to go slow because an MV refresh is a query.
    But you need to provide a lot more information and metrics about your system if you want to get any advice that might be specific to your particular case.

  • Crystal Report Takes very long time to display results

    Dear All,
    I am new to Crystal reports. We have installed Crystal report developer 2008 SP3 on Windows7 Service pack 1. We are creating reports from SAP ECC 6 EHP 4 Ready in Crystal Reports. The problem we are facing is that every report which we have developed in Crtystal reports is taking around 1 to 2 hours to display results. the reports are pertaining to only one day or one month data. we have also switch off "Verify On First Refresh", "Verify Stored Procedures On First Refresh", "Verify Database" and  we are also not saving data on report level as per the threads which are already posted in the forum pertaining to our problem.
    You are requested to kindly guide me how I can improve the performance of our crystal reports.
    Regards,
    Danish.

    You select expert formula says enough. It would appear that little or no data filtering is being carried out on the database server. Thus all records will be returned to Crystal and then filtered locally.
    You need to try and incorporate the logic of formula  {@Form_PeriodCvn} into the select expert. Or build a view/stored procedure which returns a value compatible with your filtering requirements.
    What is contents of formula  {@Form_PeriodCvn}
    Ian

  • Query takes long time to return results.

    I am on Oracle database 10g Enterprise Edition Release 10.2.0.4.0 – 64 bit
    This query takes about 58 seconds to return 180 rows...
             SELECT order_num,
                    order_date,
                    company_num,
                    customer_num,
                    address_type,
                    create_date as address_create_date,
                    contact_name,
                    first_name,
                    middle_init,
                    last_name,
                    company_name,
                    street_address_1,
                    customer_class,
                    city,
                    state,
                    zip_code,
                    country_code,
                    MAX(decode(media_type,
                               'PHH',
                               phone_area_code || '''' || phone_number,
                               NULL)) home_phone,
                    MAX(decode(media_type,
                               'PHW',
                               phone_area_code || '''' || phone_number,
                               NULL)) work_phone,
                    address_seq_num,
                    street_address_2
               FROM (SELECT oh.order_num order_num,
                            oh.order_datetime order_date,
                            oh.company_num company_num,
                            oh.customer_num customer_num,
                            ad.address_type address_type,
                            c.create_date create_date,
                            con.first_name || '''' || con.last_name contact_name,
                            con.first_name first_name,
                            con.middle_init middle_init,
                            con.last_name last_name,
                            ad.company_name company_name,
                            ad.street_address_1 street_address_1,
                            c.customer_class customer_class,
                            ad.city city,
                            ad.state state,
                            ad.zip_code zip_code,
                            ad.country_code,
                            cph.media_type media_type,
                            cph.phone_area_code phone_area_code,
                            cph.phone_number phone_number,
                            ad.address_seq_num address_seq_num,
                            ad.street_address_2 street_address_2
                       FROM reporting_base.gt_gaft_orders gt,
                            doms.us_ordhdr   oh,
                            doms.us_address  ad,
                            doms.us_customer c,
                            doms.us_contact  con,
                            doms.us_contph   cph
                      WHERE oh.customer_num = c.customer_num(+)
                        AND oh.customer_num = ad.customer_num(+)
                        AND (
                               ad.customer_num = c.customer_num
                        AND
                               ad.address_type = 'B'
                         OR   (
                                ad.customer_num = c.customer_num
                        AND
                                ad.address_type = 'S'
                        AND
                            ad.address_seq_num = oh.ship_to_seq_num
                        AND ad.customer_num = con.customer_num(+)
                        AND ad.address_type = con.address_type(+)
                        AND ad.address_seq_num = con.address_seq_num(+)
                        AND con.customer_num = cph.customer_num(+)
                        AND con.contact_id = cph.contact_id(+)
                        AND oh.order_num = gt.order_num
                        AND oh.business_unit_id = gt.business_unit_id)
              GROUP BY order_num,
                       order_date,
                       company_num,
                       customer_num,
                       address_type,
                       create_date,
                       contact_name,
                       first_name,
                       middle_init,
                       last_name,
                       company_name,
                       street_address_1,
                       customer_class,
                       city,
                       state,
                       zip_code,
                       country_code,
                       address_seq_num,
                       street_address_2;This is the explain plan for the query:
    Plan
    SELECT STATEMENT FIRST_ROWS Cost: 21 Bytes: 207 Cardinality: 1
         18 HASH GROUP BY Cost: 21 Bytes: 207 Cardinality: 1
               17 NESTED LOOPS OUTER Cost: 20 Bytes: 207 Cardinality: 1
                     14 NESTED LOOPS OUTER Cost: 16 Bytes: 183 Cardinality: 1
                           11 FILTER
                                 10 NESTED LOOPS OUTER Cost: 12 Bytes: 152 Cardinality: 1
                                       7 NESTED LOOPS OUTER Cost: 8 Bytes: 74 Cardinality: 1
                                             4 NESTED LOOPS OUTER Cost: 5 Bytes: 56 Cardinality: 1
                                                   1 TABLE ACCESS FULL TABLE (TEMP) REPORTING_BASE.GT_GAFT_ORDERS Cost: 2 Bytes: 26 Cardinality: 1
                                                   3 TABLE ACCESS BY INDEX ROWID TABLE DOMS.US_ORDHDR Cost: 3 Bytes: 30 Cardinality: 1
                                                         2 INDEX UNIQUE SCAN INDEX (UNIQUE) DOMS.USORDHDR_IXUPK_ORDNUMBUID Cost: 2 Cardinality: 1
                                             6 TABLE ACCESS BY GLOBAL INDEX ROWID TABLE DOMS.US_CUSTOMER Cost: 3 Bytes: 18 Cardinality: 1 Partition #: 11
                                                   5 INDEX UNIQUE SCAN INDEX (UNIQUE) DOMS.USCUSTOMER_IXUPK_CUSTNUM Cost: 2 Cardinality: 1
                                       9 TABLE ACCESS BY GLOBAL INDEX ROWID TABLE DOMS.US_ADDRESS Cost: 4 Bytes: 156 Cardinality: 2 Partition #: 13
                                             8 INDEX RANGE SCAN INDEX (UNIQUE) DOMS.USADDR_IXUPK_CUSTATYPASEQ Cost: 3 Cardinality: 2
                           13 TABLE ACCESS BY GLOBAL INDEX ROWID TABLE DOMS.US_CONTACT Cost: 4 Bytes: 31 Cardinality: 1 Partition #: 15
                                 12 INDEX RANGE SCAN INDEX DOMS.USCONT_IX_CNATAS Cost: 3 Cardinality: 1
                     16 TABLE ACCESS BY GLOBAL INDEX ROWID TABLE DOMS.US_CONTPH Cost: 4 Bytes: 24 Cardinality: 1 Partition #: 17
                           15 INDEX RANGE SCAN INDEX (UNIQUE) DOMS.USCONTPH_IXUPK_CUSTCONTMEDSEQ Cost: 3 Cardinality: 1 Cost is good. All indexes are used. However the time to return the data is very high.
    Any ideas to make the query faster?.
    Thanks

    Hi, here is the tkprof output as requested by Rob..
    TKPROF: Release 10.2.0.4.0 - Production on Mon Jul 13 09:07:09 2009
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    Trace file: axispr1_ora_15293.trc
    Sort options: default
    count    = number of times OCI procedure was executed
    cpu      = cpu time in seconds executing
    elapsed  = elapsed time in seconds executing
    disk     = number of physical reads of buffers from disk
    query    = number of buffers gotten for consistent read
    current  = number of buffers gotten in current mode (usually for update)
    rows     = number of rows processed by the fetch or execute call
    SELECT ORDER_NUM, ORDER_DATE, COMPANY_NUM, CUSTOMER_NUM, ADDRESS_TYPE,
      CREATE_DATE AS ADDRESS_CREATE_DATE, CONTACT_NAME, FIRST_NAME, MIDDLE_INIT,
      LAST_NAME, COMPANY_NAME, STREET_ADDRESS_1, CUSTOMER_CLASS, CITY, STATE,
      ZIP_CODE, COUNTRY_CODE, MAX(DECODE(MEDIA_TYPE, 'PHH', PHONE_AREA_CODE ||
      '''' || PHONE_NUMBER, NULL)) HOME_PHONE, MAX(DECODE(MEDIA_TYPE, 'PHW',
      PHONE_AREA_CODE || '''' || PHONE_NUMBER, NULL)) WORK_PHONE, ADDRESS_SEQ_NUM,
       STREET_ADDRESS_2
    FROM
    (SELECT OH.ORDER_NUM ORDER_NUM, OH.ORDER_DATETIME ORDER_DATE, OH.COMPANY_NUM
      COMPANY_NUM, OH.CUSTOMER_NUM CUSTOMER_NUM, AD.ADDRESS_TYPE ADDRESS_TYPE,
      C.CREATE_DATE CREATE_DATE, CON.FIRST_NAME || '''' || CON.LAST_NAME
      CONTACT_NAME, CON.FIRST_NAME FIRST_NAME, CON.MIDDLE_INIT MIDDLE_INIT,
      CON.LAST_NAME LAST_NAME, AD.COMPANY_NAME COMPANY_NAME, AD.STREET_ADDRESS_1
      STREET_ADDRESS_1, C.CUSTOMER_CLASS CUSTOMER_CLASS, AD.CITY CITY, AD.STATE
      STATE, AD.ZIP_CODE ZIP_CODE, AD.COUNTRY_CODE, CPH.MEDIA_TYPE MEDIA_TYPE,
      CPH.PHONE_AREA_CODE PHONE_AREA_CODE, CPH.PHONE_NUMBER PHONE_NUMBER,
      AD.ADDRESS_SEQ_NUM ADDRESS_SEQ_NUM, AD.STREET_ADDRESS_2 STREET_ADDRESS_2
      FROM REPORTING_BASE.GT_GAFT_ORDERS GT, DOMS.US_ORDHDR OH, DOMS.US_ADDRESS
      AD, DOMS.US_CUSTOMER C, DOMS.US_CONTACT CON, DOMS.US_CONTPH CPH WHERE
      OH.ORDER_NUM = GT.ORDER_NUM AND OH.BUSINESS_UNIT_ID = GT.BUSINESS_UNIT_ID
      AND OH.CUSTOMER_NUM = C.CUSTOMER_NUM(+) AND OH.CUSTOMER_NUM =
      AD.CUSTOMER_NUM(+) AND AD.CUSTOMER_NUM = C.CUSTOMER_NUM AND (
      AD.ADDRESS_TYPE = 'B' OR ( AD.ADDRESS_TYPE = 'S' AND AD.ADDRESS_SEQ_NUM =
      OH.SHIP_TO_SEQ_NUM ) ) AND AD.CUSTOMER_NUM = CON.CUSTOMER_NUM(+) AND
      AD.ADDRESS_TYPE = CON.ADDRESS_TYPE(+) AND AD.ADDRESS_SEQ_NUM =
      CON.ADDRESS_SEQ_NUM(+) AND CON.CUSTOMER_NUM = CPH.CUSTOMER_NUM(+) AND
      CON.CONTACT_ID = CPH.CONTACT_ID(+) ) GROUP BY ORDER_NUM, ORDER_DATE,
      COMPANY_NUM, CUSTOMER_NUM, ADDRESS_TYPE, CREATE_DATE, CONTACT_NAME,
      FIRST_NAME, MIDDLE_INIT, LAST_NAME, COMPANY_NAME, STREET_ADDRESS_1,
      CUSTOMER_CLASS, CITY, STATE, ZIP_CODE, COUNTRY_CODE, ADDRESS_SEQ_NUM,
      STREET_ADDRESS_2
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute      0      0.00       0.00          0          0          0           0
    Fetch      257      0.04       0.05         45          0          0        6421
    total      257      0.04       0.05         45          0          0        6421
    Misses in library cache during parse: 0
    Parsing user id: 126
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute      0      0.00       0.00          0          0          0           0
    Fetch      257      0.04       0.05         45          0          0        6421
    total      257      0.04       0.05         45          0          0        6421
    Misses in library cache during parse: 0
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute      0      0.00       0.00          0          0          0           0
    Fetch        0      0.00       0.00          0          0          0           0
    total        0      0.00       0.00          0          0          0           0
    Misses in library cache during parse: 0
        1  user  SQL statements in session.
        0  internal SQL statements in session.
        1  SQL statements in session.
    Trace file: axispr1_ora_15293.trc
    Trace file compatibility: 10.01.00
    Sort options: default
           1  session in tracefile.
           1  user  SQL statements in trace file.
           0  internal SQL statements in trace file.
           1  SQL statements in trace file.
           1  unique SQL statements in trace file.
         289  lines in trace file.
          83  elapsed seconds in trace file.Thanks in advance!

  • Answers report displaying 0s even though SQL returns data from sqlplus

    OBIEE 10.1.3.3.3
    I created a few measures in the RPD and when I run a report against them I get all zeros. I pulled the query from the session log and I ran it from SQL Plus and found that the query generated by BI Server was actually returning data (numbers other than zeros) from the SQL plus prompt.
    However for some reason those numbers are not being displayed in Answers.
    The report is a simple one with name and count as 2 columns. The count column is showing all zeros.
    When I put a filter on the report on the name column, i do get a record without the zero.
    Can someone let me know if I am missing something ?
    Edited by: qqq on Sep 9, 2009 9:50 AM

    I dont think so i understood the problem.
    Can you copy paste the query here so we would understand the problem and exactly whats going wrong?
    You are saying count column.count() of what are you taking??And whats the filter your applying??

  • Hyperion Financial Reporting is taking long time to show the User POV

    Hi,
    we are using the HFR (version 9.3.1.2) and when i double click on any report in the workspace it is taking 5 minutes to show me the User POV. Can any one of you let me know how to find where the issue is.
    Regards,
    VJ

    Hi VJ
    Things that I am aware of that can slow down reports are:
    1. Lots of members on the page (HFR tries to bring all the data into memory when run to speed up data display when changing from page to page)
    2. Nesting of attributes (due to dynamic nature of calculations)
    3. Nesting of dynamic calcs (similar to above)
    If you have any of the above that could be your issue although it sounds like it may be more a hardware issue than an issue with the reports themselves. Does it always take that long? even if you re-run a report that has been run before?
    Regards
    Stuart

  • How to find out which report in taking maximum time in production ?

    Hi,
    I have received Early Watch Alert Report from Basis. It has some reports that have been pointed out by SAP that take large amount of DB time. I shall be tuning the code technically and Functionally. Well, the place where i require the help is that How can I see the time that a report or a Function module (Especially from a web service) take after some work has been performaed on it. Report can still can be run, But It is not desirable to run it since it is scheduled and has to be run at that time as an necessary requirement.
    Is there any SAP transaction that we can use to see if there are any improvement in the Time of execution of the object.
    Regards,
    Chitwanjit

    Hi Chitwanjit,
    STAD and ST03 are your friends.
    - Get in contact with your SAP Basis in order to get an explanation how
    to use this tools (if necessary).
    - SAP courses ADM315, BC490 explain these tools
    - search in help.sap.com,
    SDN, google, there should be plenty of information available as well.
    Kind regards,
    Hermann

  • Infinite time on compiling results

    A known issue with Support pages. Reported and being worked on.

    Hi guys, I recently downgraded from Windows8 to 7(64) bit and accidently deleted the recovery drive,So i headed over to the HP official website to download the missing drivers. I selected my device and my OS and when i clicked on OK, the usual " HP is compiling your results. This could take up to 3 minutes, depending on your computer and connection speed. Thank you for your patience" came about. I waited, 2mins, 3 mins, 5 mins, 10 mins, 20mins, 1hr......But nothing ever came after that. Without the drivers, i cant do anything. Please let me know what's wrong or what i am doing wrongThank you

  • Why oracle text index column taking long  time

    why oracle text index column is taking long time to return result.I created text index on a column if I run the query on a single table result is very fast.If I join table with other table (10 records only )
    it is taking long time but in explain plan it is searching by index only.
    I created this index for searching a varchar2 column,the data is comma seperated values like ( UK,US,IT,BR) and the table having records 20 lakhs.Normally if I query with like operater
    ( like '%US%' ) it is taking full table scan because I am using '%' both sides. Please help me on this regard how to search the data with less time. Here is may sample code and explain plan.
    SQL*Plus: Release 9.2.0.1.0 - Production on Wed Jan 28 16:54:22 2009
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.1.0 - Production
    SQL> set timing on
    SQL> set linesize 180
    SQL> explain plan for SELECT T.esongid FROM (SELECT A.ESONGID FROM wcmedeco.EDECO_ESONGS_TERR_CTRY 
    A WHERE CONTAINS(A.TERR_CTRY_NAMES,'US')>0  
      2  GROUP BY A.ESONGID)K,T
      3  WHERE  K.ESONGID=T.ESONGID;
    Explained.
    Elapsed: 00:00:00.01
    SQL> select *from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    | Id  | Operation                      |  Name                   | Rows  | Bytes | Cost  |
    |   0 | SELECT STATEMENT               |                         |     1 |    26 |     4 |
    |   1 |  NESTED LOOPS                  |                         |     1 |    26 |     4 |
    |   2 |   VIEW                         |                         |     1 |    13 |     4 |
    |   3 |    SORT GROUP BY               |                         |     1 |    89 |     4 |
    |   4 |     TABLE ACCESS BY INDEX ROWID| EDECO_ESONGS_TERR_CTRY  |     1 |    89 |     2 |
    |   5 |      DOMAIN INDEX              | IDX_TERR_CTRY_NAMES     |       |       |     0 |
    |   6 |   INDEX RANGE SCAN             | IDX_ESONGID_T           |     1 |    13 |     1 |
    PLAN_TABLE_OUTPUT
    Note: cpu costing is off, 'PLAN_TABLE' is old version
    14 rows selected.
    Elapsed: 00:00:00.00
    SQL> Regards,
    Rajasekhar

    You have not formatted your code properly so we cannot see the query you're executing. Please put some line breaks in.
    Secondly, how fresh are the statistics on those tables? Are you really returning one record out of twenty million?
    Cheers, APC
    blog: http://radiofreetooting.blogspot.com

  • Query accessing SSAS cube is taking more time in power view report

    Hi,
    My SSAS server is having 16 Core's . I have created a power view in sharepoint site, which is accessing ssas cube.
    The report is taking more time to show the result.  I traced the DAX query using SQL Server profiler. When I ran this DAX query in SSAS server directly, then its taking less time but when the same query running from sharepoint server (power view) , it
    is taking more time. Number of records in the fact table is 300M . 
    Also i tracked the %process time in performance monitor, mostly the line is below 20%. I think the CPU is not fully utilized..
    Could you please help me to improve the performance of my report.
    Regards,
    Arun

    Hi Arun,
    According to your description, you create a PowerView report in SharePoint site connect to SSAS cube, the problem is that it take long time to show the result in the report, now you want to improve report performance, right?
    In your scenario, you said that it takes more time to return the result in PowerView report than run the query directly in SSMS. For a report, its run time contain retrieval data time and render report time. So it takes more time to return the result in
    PowerView report than run the query directly in SSMS. And there are 300M records in the fact table, the performance can be caused by large data. Here is a blog which describes tracks down Power View performance problems.
    http://blogs.msdn.com/b/psssql/archive/2013/07/29/tracking-down-power-view-performance-problems.aspx
    Regards,
    Charlie Liao
    TechNet Community Support

  • My ALV Report is taking too much time to execute

    Hi Friends,
    My ALV Report is taking long time for execution(more than 1.5 Hrs).Pls suggest the changes to be done to improove the performance.Its very urgent.Pls respond as soon as possible.
    Thanks & Regards,
    Sunil Maurya
    Report is as follows :
    REPORT  YSEG_PROFIT.
    TABLES : ZSEGMENT, coep.
    TYPE-POOLS: slis.
    DATA : BEGIN OF I_COEP OCCURS 0,
             BELNR  LIKE COEP-BELNR,
             BUZEI  LIKE COEP-BUZEI,
             PERIO  LIKE COEP-PERIO,
             WOGBTR LIKE COEP-WOGBTR,
             OBJNR  LIKE COEP-OBJNR,
             KSTAR  LIKE COEP-KSTAR,
             PAOBJNR LIKE COEP-PAOBJNR,
             KVGR5  LIKE ZSEGMENT-KVGR5,
             KAUFN  LIKE CE4KBL1_ACCT-KAUFN,
           END OF I_COEP.
    DATA : BEGIN OF I_SECTOR OCCURS 0,
            KVGR5  LIKE ZSEGMENT-KVGR5,
          END OF I_SECTOR.
    DATA : BEGIN OF I_AUFK OCCURS 0,
            OBJNR LIKE AUFK-OBJNR,
            PSPEL LIKE AUFK-PSPEL,
            KDAUF LIKE AUFK-KDAUF,
            KDPOS LIKE AUFK-KDPOS,
           END OF I_AUFK.
    DATA : BEGIN OF I_VBAKP OCCURS 0,
            OBJNR LIKE VBAP-OBJNR,
            KVGR5 LIKE VBAK-VBELN,
          END OF I_VBAKP.
    DATA : BEGIN OF I_PRPS OCCURS 0,
            OBJNR LIKE PRPS-OBJNR,
            PSPHI LIKE PRPS-PSPHI,
            ASTNR LIKE PROJ-ASTNR,
          END OF I_PRPS.
    DATA : BEGIN OF I_OUTPUT OCCURS 0,
             KSTAR LIKE COEP-KSTAR,
             MCTXT LIKE CSKU-MCTXT,
             S01   LIKE COEP-WOGBTR,
             S02   LIKE COEP-WOGBTR,
             S03   LIKE COEP-WOGBTR,
             S04   LIKE COEP-WOGBTR,
             S05   LIKE COEP-WOGBTR,
             S06   LIKE COEP-WOGBTR,
             S07   LIKE COEP-WOGBTR,
             S08   LIKE COEP-WOGBTR,
             S09   LIKE COEP-WOGBTR,
             OTH   like COEP-WOGBTR,
             TOTAL LIKE COEP-WOGBTR,
          END OF I_OUTPUT.
    DATA : BEGIN OF I_AFVC OCCURS 0,
            OBJNR LIKE AFVC-OBJNR,
            PROJN LIKE AFVC-PROJN,
            PROJ LIKE   PROJ-PSPID,
            PSPNR LIKE PROJ-PSPNR,
           END OF I_AFVC.
    DATA : BEGIN OF I_PROJ OCCURS 0,
            PSPNR LIKE PROJ-PSPNR,
            ASTNR LIKE PROJ-ASTNR,
           END OF I_PROJ.
    DATA : I_NP LIKE STANDARD TABLE OF I_COEP WITH HEADER LINE.
    DATA : I_NV LIKE STANDARD TABLE OF I_COEP WITH HEADER LINE.
    DATA : I_DETAIL LIKE STANDARD TABLE OF I_COEP WITH HEADER LINE.
    DATA : I_WB LIKE STANDARD TABLE OF I_COEP WITH HEADER LINE.
    DATA : I_PR LIKE STANDARD TABLE OF I_COEP WITH HEADER LINE.
    data : t_fieldcat_sum_rep TYPE slis_t_fieldcat_alv.
    data : t_fieldcat_det_rep TYPE slis_t_fieldcat_alv.
    DATA: k_fieldcat    TYPE slis_fieldcat_alv.
    Declaration by Sunil Maurya for sorting
    DATA : GT_SORT TYPE SLIS_T_SORTINFO_ALV,
           GS_SORT TYPE SLIS_SORTINFO_ALV.
    DATA : GT_SORT1 TYPE SLIS_T_SORTINFO_ALV,
           GS_SORT1 TYPE SLIS_SORTINFO_ALV.
    *data : it_sortcat type slis_t_sortinfo_alv.
    *DATA : k_sortcat  like line of it_sortcat.
    **data : wa_sort like line of it_sortcat.
    Declaration by Sunil Maurya for sorting
    constants :  c_user_command TYPE char30 VALUE 'USER_COMMAND'.
    *Selection screen
    SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME TITLE TEXT-001.
    PARAMETER : P_PERIO1   LIKE COEP-PERIO obligatory,
               P_PERIO2   LIKE COEP-PERIO MODIF ID D1,
                P_GJAHR    LIKE COEP-GJAHR obligatory.
    select-options :  P_KSTAR  for COEP-KSTAR,
                      P_GSBER  FOR COEP-GSBER.
    SELECT-OPTIONS : S_KVGR5 FOR ZSEGMENT-KVGR5 MODIF ID D1.
    SELECTION-SCREEN END OF BLOCK A.
    INITIALIZATION.
       S_KVGR5-OPTION = 'BT' .
       S_KVGR5-LOW = 'S01'.
       S_KVGR5-HIGH = 'S09'.
       APPEND S_KVGR5.
    AT SELECTION-SCREEN OUTPUT.
        LOOP AT SCREEN.
          IF SCREEN-GROUP1 = 'D1'.
             SCREEN-INPUT = '0'.
             MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
    START-OF-SELECTION.
      PERFORM GET_SECTORS.
      PERFORM GET_DATA_COEP.
      PERFORM VALIDATE_SECTOR.
      PERFORM GROUP_OUTPUT.
    PERFORM BUILD_SORTCAT. " Inserted by by Sunil Maurya for sorting
      PERFORM BUILD_CATLOG.
      PERFORM DISPLAY_OUTPUT.
    *&      Form  GET_DATA_COEP
          text
    -->  p1        text
    <--  p2        text
    FORM GET_DATA_COEP .
    SELECT BELNR BUZEI PERIO WOGBTR OBJNR KSTAR PAOBJNR
    FROM COEP INTO TABLE I_COEP WHERE
            KOKRS = 'KBL' AND
           PERIO >= P_PERIO1 AND
           PERIO <= P_PERIO2 AND
            PERIO = P_PERIO1 AND
            GJAHR = P_GJAHR AND
            KSTAR NE '' AND
            OBJNR NE '' AND
            KSTAR in P_KSTAR AND
            GSBER IN P_GSBER. "AND
           BELNR = '0103991827' .
      SORT I_COEP BY OBJNR.
      DELETE I_COEP WHERE OBJNR+0(2) <> 'VB' AND
                          OBJNR+0(2) <> 'PR' AND
                          OBJNR+0(2) <> 'NV' AND
                          OBJNR+0(2) <> 'NP' AND
                          OBJNR+0(2) <> 'AO'.
      SORT I_COEP BY KSTAR.
      DELETE I_COEP WHERE KSTAR+0(5) <> '00003' AND
                          KSTAR+0(5) <> '00004'.
      LOOP AT I_COEP WHERE OBJNR+0(2) = 'NP'.
        MOVE I_COEP TO I_NP.
        APPEND I_NP.
        CLEAR : I_NP, I_COEP.
      ENDLOOP.
      LOOP AT I_COEP WHERE OBJNR+0(2) = 'NV'.
        MOVE I_COEP TO I_NV.
        APPEND I_NV.
        CLEAR : I_NV, I_COEP.
      ENDLOOP.
      LOOP AT I_COEP WHERE OBJNR+0(2) = 'VB' .
        MOVE I_COEP TO I_WB.
        APPEND I_WB.
        CLEAR : I_WB, I_COEP.
      ENDLOOP.
      LOOP AT I_COEP WHERE OBJNR+0(2) = 'PR' .
        MOVE I_COEP TO I_PR.
        APPEND I_PR.
        CLEAR : I_PR, I_COEP.
      ENDLOOP.
    *Inserted by Sunil Maurya for PAOBJNR = "AO....."
    Data : ind type sy-tabix.
    loop at i_coep where OBJNR+0(2) = 'AO'.
    ind = sy-tabix.
    select single KAUFN into i_coep-KAUFN from CE4KBL1_ACCT where PAOBJNR =
    i_coep-PAOBJNR.
    select single KVGR5 into i_coep-kvgr5 from vbak where vbeln =
    i_coep-kaufn.
    modify i_coep index ind.
    clear i_coep.
    endloop.
    *Inserted by Sunil Maurya for PAOBJNR = "AO....."
    *LOOP AT I_COEP WHERE OBJNR+0(2) = 'AO' .
       MOVE I_COEP TO I_AO.
       APPEND I_AO.
       CLEAR : I_AO, I_COEP.
    *ENDLOOP.
    ENDFORM.                    " GET_DATA_COEP
    *&      Form  GET_SECTORS
          text
    -->  p1        text
    <--  p2        text
    FORM GET_SECTORS .
      DATA : L_FR TYPE I,
             L_TO TYPE I.
      DATA :  L_CH1(1).
      LOOP AT S_KVGR5.
        IF S_KVGR5-OPTION = 'EQ'.
          I_SECTOR-KVGR5 = S_KVGR5-LOW.
          APPEND I_SECTOR.
          CLEAR : I_SECTOR.
          CONCATENATE '5' S_KVGR5-LOW+1(2) INTO I_SECTOR-KVGR5.
          APPEND I_SECTOR.
          CLEAR : I_SECTOR.
        ENDIF.
        IF S_KVGR5-OPTION = 'BT'.
          L_FR = S_KVGR5-LOW+1(2).
          L_TO = S_KVGR5-HIGH+1(2).
          WHILE L_FR <= L_TO.
            L_CH1 = L_FR.
            CONCATENATE 'S0' L_CH1 INTO I_SECTOR-KVGR5.
            APPEND I_SECTOR.
            CONCATENATE '50' L_CH1 INTO I_SECTOR-KVGR5.
            APPEND I_SECTOR.
            CLEAR : I_SECTOR, L_CH1.
            L_FR = L_FR + 1.
          ENDWHILE.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " GET_SECTORS
    *&      Form  VALIDATE_SECTOR
          text
    -->  p1        text
    <--  p2        text
    FORM VALIDATE_SECTOR .
    *get data from AUFK for NP & NV type intab
    IF I_NP[] IS NOT INITIAL.
      SELECT OBJNR PSPEL KDAUF KDPOS FROM AUFK
      INTO TABLE I_AUFK
      FOR ALL ENTRIES IN I_NP
      WHERE OBJNR = I_NP-OBJNR.
    *Push this data in I_WB where order no exist in AUFK
      LOOP AT I_AUFK WHERE KDAUF NE ''.
        I_WB-OBJNR = I_AUFK-OBJNR.
        APPEND I_WB.
        CLEAR : I_AUFK, I_WB.
      ENDLOOP.
    *Push this data in I_PR where order no exist in AUFK
      LOOP AT I_AUFK WHERE PSPEL NE ''.
        I_PR-OBJNR = I_AUFK-OBJNR.
        APPEND I_PR.
        CLEAR : I_AUFK, I_PR.
      ENDLOOP.
    ENDIF.
      SELECT BOBJNR AKVGR5 FROM VBAK AS A INNER JOIN VBAP AS B
      ON AVBELN = BVBELN
      INTO TABLE I_VBAKP
      FOR ALL ENTRIES IN I_WB
      WHERE B~VBELN = I_WB-OBJNR+2(10).
      SORT I_VBAKP BY OBJNR.
      SORT I_COEP BY OBJNR.
      LOOP AT I_WB.
        READ TABLE I_VBAKP WITH KEY OBJNR = I_WB-OBJNR.
        IF SY-SUBRC = 0.
          READ TABLE I_SECTOR WITH KEY KVGR5 = I_VBAKP-KVGR5.
          IF SY-SUBRC <> 0.
           DELETE I_COEP WHERE OBJNR = I_WB-OBJNR.
             loop at i_coep where objnr = i_wb-objnr.
                  i_coep-kvgr5 = 'OTH'.
                  modify i_coep.
                  clear : i_coep.
             endloop.
          ELSE.
         READ TABLE I_COEP WITH KEY BELNR = I_WB-BELNR BUZEI = I_WB-BUZEI.
           READ TABLE I_COEP WITH KEY OBJNR = I_WB-OBJNR.
            IF SY-SUBRC = 0.
              I_COEP-KVGR5 = I_SECTOR-KVGR5.
              MODIFY I_COEP INDEX SY-TABIX.
              LOOP AT I_COEP WHERE OBJNR = I_WB-OBJNR.
                I_COEP-KVGR5 = I_SECTOR-KVGR5.
                MODIFY I_COEP.
                CLEAR : I_COEP.
              ENDLOOP.
            ENDIF.
          ENDIF.
        ELSE.
         DELETE I_COEP WHERE OBJNR = I_WB-OBJNR.
             loop at i_coep where objnr = i_wb-objnr.
                  i_coep-kvgr5 = 'OTH'.
                  modify i_coep.
                  clear : i_coep.
             endloop.
        ENDIF.
        CLEAR : I_VBAKP, I_SECTOR, I_COEP.
      ENDLOOP.
    IF I_PR[] IS NOT INITIAL.
      SELECT AOBJNR APSPHI B~ASTNR
      FROM PRPS AS A INNER JOIN PROJ AS B
      ON APSPHI = BPSPNR
      INTO TABLE I_PRPS
      FOR ALL ENTRIES IN I_PR
      WHERE A~OBJNR = I_PR-OBJNR.
    ENDIF.
      IF I_NV[] IS NOT INITIAL.
        SELECT OBJNR PROJN FROM AFVC INTO TABLE I_AFVC
        FOR ALL ENTRIES IN I_NV
        WHERE OBJNR = I_NV-OBJNR AND
              PROJN <> ''  .
        LOOP AT I_AFVC.
          CALL FUNCTION 'CONVERSION_EXIT_ABPSP_OUTPUT'
            EXPORTING
              INPUT         = I_AFVC-PROJN
           IMPORTING
             OUTPUT        = I_AFVC-PROJ
            I_AFVC-PROJ = I_AFVC-PROJ+0(9).
            CALL FUNCTION 'CONVERSION_EXIT_KONPD_INPUT'
              EXPORTING
                INPUT           = I_AFVC-PROJ
             IMPORTING
               OUTPUT          =  I_AFVC-PSPNR.
            MODIFY I_AFVC.
            CLEAR : I_AFVC.
        ENDLOOP.
        SELECT PSPNR ASTNR FROM PROJ INTO TABLE I_PROJ
        FOR ALL ENTRIES IN I_AFVC
        WHERE PSPNR = I_AFVC-PSPNR.
        LOOP AT I_NV.
           I_PRPS-OBJNR = I_NV-OBJNR.
           READ TABLE I_AFVC WITH KEY OBJNR = I_NV-OBJNR.
           IF SY-SUBRC = 0.
             READ TABLE I_PROJ WITH KEY PSPNR = I_AFVC-PSPNR.
             IF SY-SUBRC = 0.
               I_PRPS-ASTNR = I_PROJ-ASTNR.
             ENDIF.
           ENDIF.
            APPEND I_PRPS.
            I_PR-OBJNR = I_NV-OBJNR.
            APPEND I_PR.
            CLEAR : I_NV, I_AFVC, I_PROJ, I_PR.
        ENDLOOP.
      ENDIF.
      SORT I_PRPS BY OBJNR.
      LOOP AT I_PR.
        READ TABLE I_PRPS WITH KEY OBJNR = I_PR-OBJNR.
        IF SY-SUBRC = 0.
          READ TABLE I_SECTOR WITH KEY KVGR5 = I_PRPS-ASTNR+5(3).
          IF SY-SUBRC <> 0.
           DELETE I_COEP WHERE OBJNR = I_PR-OBJNR.
             loop at i_coep where objnr = i_pr-objnr.
                  i_coep-kvgr5 = 'OTH'.
                  modify i_coep.
                  clear : i_coep.
             endloop.
          ELSE.
            READ TABLE I_COEP WITH KEY OBJNR = I_PR-OBJNR.
            IF SY-SUBRC = 0.
              CONCATENATE 'S' I_SECTOR-KVGR5+1(2) INTO I_COEP-KVGR5.
              MODIFY I_COEP INDEX SY-TABIX.
              LOOP AT I_COEP WHERE OBJNR = I_PR-OBJNR.
                CONCATENATE 'S' I_SECTOR-KVGR5+1(2) INTO I_COEP-KVGR5.
                MODIFY I_COEP.
                CLEAR : I_COEP.
              ENDLOOP.
            ENDIF.
          ENDIF.
        ELSE.
         DELETE I_COEP WHERE OBJNR = I_PR-OBJNR.
            loop at i_coep where objnr = i_pr-objnr.
                  i_coep-kvgr5 = 'OTH'.
                  modify i_coep.
                  clear : i_coep.
             endloop.
        ENDIF.
        CLEAR : I_PR, I_PRPS, I_SECTOR, I_COEP.
      ENDLOOP.
    ENDFORM.                    " VALIDATE_SECTOR
    *&      Form  GROUP_OUTPUT
          text
    -->  p1        text
    <--  p2        text
    FORM GROUP_OUTPUT .
      LOOP AT I_COEP.
        I_OUTPUT-KSTAR = I_COEP-KSTAR.
        IF I_COEP-KVGR5 = 'S01'.
          I_OUTPUT-S01 = I_COEP-WOGBTR.
        ENDIF.
        IF I_COEP-KVGR5 = 'S02'.
          I_OUTPUT-S02 = I_COEP-WOGBTR.
        ENDIF.
        IF I_COEP-KVGR5 = 'S03'.
          I_OUTPUT-S03 = I_COEP-WOGBTR.
        ENDIF.
        IF I_COEP-KVGR5 = 'S04'.
          I_OUTPUT-S04 = I_COEP-WOGBTR.
        ENDIF.
        IF I_COEP-KVGR5 = 'S05'.
          I_OUTPUT-S05 = I_COEP-WOGBTR.
        ENDIF.
        IF I_COEP-KVGR5 = 'S06'.
          I_OUTPUT-S06 = I_COEP-WOGBTR.
        ENDIF.
        IF I_COEP-KVGR5 = 'S07'.
          I_OUTPUT-S07 = I_COEP-WOGBTR.
        ENDIF.
        IF I_COEP-KVGR5 = 'S08'.
          I_OUTPUT-S08 = I_COEP-WOGBTR.
        ENDIF.
        IF I_COEP-KVGR5 = 'S09'.
          I_OUTPUT-S09 = I_COEP-WOGBTR.
        ENDIF.
        IF I_COEP-KVGR5 = 'OTH' OR I_COEP-KVGR5 = ''.
          I_OUTPUT-OTH = I_COEP-WOGBTR.
        ENDIF.
        COLLECT I_OUTPUT.
        CLEAR : I_COEP, I_OUTPUT.
      ENDLOOP.
      LOOP AT I_OUTPUT.
        SELECT SINGLE MCTXT FROM CSKU
        INTO I_OUTPUT-MCTXT
        WHERE KTOPL = 'KBL' AND
              SPRAS = SY-LANGU AND
              KSTAR = I_OUTPUT-KSTAR.
        I_OUTPUT-TOTAL = I_OUTPUT-S01 + I_OUTPUT-S02 + I_OUTPUT-S03
                        + I_OUTPUT-S04 + I_OUTPUT-S05 + I_OUTPUT-S06
                        + I_OUTPUT-S07 + I_OUTPUT-S08 + I_OUTPUT-S09
                        + I_OUTPUT-OTH.
        MODIFY I_OUTPUT.
        CLEAR : I_OUTPUT.
      ENDLOOP.
    ENDFORM.                    " GROUP_OUTPUT
    *&      Form  BUILD_CATLOG
          text
    -->  p1        text
    <--  p2        text
    FORM BUILD_CATLOG .
      CLEAR k_fieldcat.
      k_fieldcat-fieldname = 'KSTAR'.
      k_fieldcat-seltext_l  = text-002.
      k_fieldcat-hotspot   = 'X'.
      APPEND k_fieldcat TO t_fieldcat_sum_rep.
      CLEAR k_fieldcat.
      k_fieldcat-fieldname = 'MCTXT'.
      k_fieldcat-seltext_l  = text-003.
      k_fieldcat-hotspot   = 'X'.
      APPEND k_fieldcat TO t_fieldcat_sum_rep.
      READ TABLE I_SECTOR WITH KEY KVGR5 = 'S01'.
      IF SY-SUBRC = 0.
        CLEAR k_fieldcat.
        k_fieldcat-fieldname = 'S01'.
        k_fieldcat-seltext_l  = text-004.
        k_fieldcat-hotspot   = 'X'.
        k_fieldcat-do_sum    = 'X'. "Statement inserted by Sunil Maurya
        APPEND k_fieldcat TO t_fieldcat_sum_rep.
      ENDIF.
      READ TABLE I_SECTOR WITH KEY KVGR5 = 'S02'.
      IF SY-SUBRC = 0.
        CLEAR k_fieldcat.
        k_fieldcat-fieldname = 'S02'.
        k_fieldcat-seltext_l  = text-005.
        k_fieldcat-hotspot   = 'X'.
        k_fieldcat-do_sum    = 'X'. "Statement inserted by Sunil Maurya
        APPEND k_fieldcat TO t_fieldcat_sum_rep.
      ENDIF.
      READ TABLE I_SECTOR WITH KEY KVGR5 = 'S03'.
      IF SY-SUBRC = 0.
        CLEAR k_fieldcat.
        k_fieldcat-fieldname = 'S03'.
        k_fieldcat-seltext_l  = text-006.
        k_fieldcat-hotspot   = 'X'.
        k_fieldcat-do_sum    = 'X'. "Statement inserted by Sunil Maurya
        APPEND k_fieldcat TO t_fieldcat_sum_rep.
      ENDIF.
      READ TABLE I_SECTOR WITH KEY KVGR5 = 'S04'.
      IF SY-SUBRC = 0.
        CLEAR k_fieldcat.
        k_fieldcat-fieldname = 'S04'.
        k_fieldcat-seltext_l  = text-007.
        k_fieldcat-hotspot   = 'X'.
        k_fieldcat-do_sum    = 'X'. "Statement inserted by Sunil Maurya
        APPEND k_fieldcat TO t_fieldcat_sum_rep.
      ENDIF.
      READ TABLE I_SECTOR WITH KEY KVGR5 = 'S05'.
      IF SY-SUBRC = 0.
        CLEAR k_fieldcat.
        k_fieldcat-fieldname = 'S05'.
        k_fieldcat-seltext_l  = text-008.
        k_fieldcat-hotspot   = 'X'.
        k_fieldcat-do_sum    = 'X'. "Statement inserted by Sunil Maurya
        APPEND k_fieldcat TO t_fieldcat_sum_rep.
      ENDIF.
      READ TABLE I_SECTOR WITH KEY KVGR5 = 'S06'.
      IF SY-SUBRC = 0.
        CLEAR k_fieldcat.
        k_fieldcat-fieldname = 'S06'.
        k_fieldcat-seltext_l  = text-009.
        k_fieldcat-hotspot   = 'X'.
        k_fieldcat-do_sum    = 'X'. "Statement inserted by Sunil Maurya
        APPEND k_fieldcat TO t_fieldcat_sum_rep.
      ENDIF.
      READ TABLE I_SECTOR WITH KEY KVGR5 = 'S07'.
      IF SY-SUBRC = 0.
        CLEAR k_fieldcat.
        k_fieldcat-fieldname = 'S07'.
        k_fieldcat-seltext_l  = text-010.
        k_fieldcat-hotspot   = 'X'.
        k_fieldcat-do_sum    = 'X'. "Statement inserted by Sunil Maurya
        APPEND k_fieldcat TO t_fieldcat_sum_rep.
      ENDIF.
      READ TABLE I_SECTOR WITH KEY KVGR5 = 'S08'.
      IF SY-SUBRC = 0.
        CLEAR k_fieldcat.
        k_fieldcat-fieldname = 'S08'.
        k_fieldcat-seltext_l  = text-011.
        k_fieldcat-hotspot   = 'X'.
        k_fieldcat-do_sum    = 'X'. "Statement inserted by Sunil Maurya
        APPEND k_fieldcat TO t_fieldcat_sum_rep.
      ENDIF.
      READ TABLE I_SECTOR WITH KEY KVGR5 = 'S09'.
      IF SY-SUBRC = 0.
        CLEAR k_fieldcat.
        k_fieldcat-fieldname = 'S09'.
        k_fieldcat-seltext_l  = text-012.
        k_fieldcat-hotspot   = 'X'.
        k_fieldcat-do_sum    = 'X'. "Statement inserted by Sunil Maurya
        APPEND k_fieldcat TO t_fieldcat_sum_rep.
      ENDIF.
        CLEAR k_fieldcat.
        k_fieldcat-fieldname = 'OTH'.
        k_fieldcat-seltext_l  = text-019.
        k_fieldcat-hotspot   = 'X'.
        k_fieldcat-do_sum    = 'X'. "Statement inserted by Sunil Maurya
        APPEND k_fieldcat TO t_fieldcat_sum_rep.
        CLEAR k_fieldcat.
        k_fieldcat-fieldname = 'TOTAL'.
        k_fieldcat-seltext_l  = text-020.
        k_fieldcat-do_sum    = 'X'. "Statement inserted by Sunil Maurya
        APPEND k_fieldcat TO t_fieldcat_sum_rep.
    *=======================================================================
        CLEAR k_fieldcat.
        k_fieldcat-fieldname = 'BELNR'.
        k_fieldcat-seltext_l  = text-013.
        APPEND k_fieldcat TO t_fieldcat_det_rep.
        CLEAR k_fieldcat.
        k_fieldcat-fieldname = 'BUZEI'.
        k_fieldcat-seltext_l  = text-014.
        APPEND k_fieldcat TO t_fieldcat_det_rep.
        CLEAR k_fieldcat.
        k_fieldcat-fieldname = 'PERIO'.
        k_fieldcat-seltext_l  = text-015.
        APPEND k_fieldcat TO t_fieldcat_det_rep.
        CLEAR k_fieldcat.
        k_fieldcat-fieldname = 'WOGBTR'.
        k_fieldcat-seltext_l  = text-016.
        APPEND k_fieldcat TO t_fieldcat_det_rep.
        CLEAR k_fieldcat.
        k_fieldcat-fieldname = 'OBJNR'.
        k_fieldcat-seltext_l  = text-018.
        APPEND k_fieldcat TO t_fieldcat_det_rep.
        CLEAR k_fieldcat.
        k_fieldcat-fieldname = 'KSTAR'.
        k_fieldcat-seltext_l  = text-002.
        APPEND k_fieldcat TO t_fieldcat_det_rep.
         CLEAR k_fieldcat.
        k_fieldcat-fieldname = 'KVGR5'.
        k_fieldcat-seltext_l  = text-017.
        APPEND k_fieldcat TO t_fieldcat_det_rep.
    *==============================================================
           Statements inserted by Sunil Maurya for sorting
    CLEAR GS_SORT.
    GS_SORT-FIELDNAME = 'KSTAR'.
    GS_SORT-SPOS      = 1.
    GS_SORT-UP        = 'X'.
    APPEND GS_SORT TO GT_SORT.
    CLEAR GS_SORT1.
    GS_SORT1-FIELDNAME = 'KSTAR'.
    GS_SORT1-SPOS      = 1.
    GS_SORT1-UP        = 'X'.
    GS_SORT1-SUBTOT    = 'X'.
    APPEND GS_SORT1 TO GT_SORT1.
    *CLEAR GS_SORT1.
    *GS_SORT1-FIELDNAME = 'WOGBTR'.
    *GS_SORT1-SPOS      = 2.
    *GS_SORT1-UP        = 'X'.
    *GS_SORT1-SUBTOT    = 'X'.
    *APPEND GS_SORT1 TO GT_SORT1.
       FORM build_sortcat.
       k_sortcat-spos = 1.
       k_sortcat-fieldname = 'KSTAR'.
       k_sortcat-up      = 'X'.
      k_sortcat-down      = 'X'.
       APPEND k_sortcat TO it_sortcat.
    clear k_sortcat.
       ENDFORM.
       Statements inserted by Sunil Maurya for sorting
    ENDFORM.                    " BUILD_CATLOG
    *&      Form  DISPLAY_OUTPUT
          text
    -->  p1        text
    <--  p2        text
    FORM DISPLAY_OUTPUT .
      DATA l_repid TYPE syrepid.
      l_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program      = l_repid
          it_fieldcat             = t_fieldcat_sum_rep
          i_callback_user_command = c_user_command
          i_save                  = 'A'
          it_sort                 = GT_SORT[] "Statements inserted by Sunil
        TABLES
          t_outtab                = I_OUTPUT
        EXCEPTIONS
          program_error           = 1
          OTHERS                  = 2.
      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.                    " DISPLAY_OUTPUT
    *&      Form  user_command
          text
    FORM user_command USING r_ucomm     LIKE sy-ucomm
                            rs_selfield TYPE slis_selfield.
      DATA: l_repid TYPE syrepid.
      l_repid = sy-repid.
      CASE r_ucomm.
        WHEN '&IC1'.
          clear : i_detail. refresh : i_detail.
          LOOP AT I_COEP WHERE KVGR5 = rs_selfield-fieldname.
              MOVE i_coep to i_detail.
              append i_detail.
              clear : i_detail, i_coep.
          endloop.
          CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
            EXPORTING
              i_callback_program      = l_repid
              it_fieldcat             = t_fieldcat_det_rep
              i_callback_user_command = c_user_command
              i_save                  = 'A'
              it_sort                 = GT_SORT1[] "Inserted by Sunil
            TABLES
              t_outtab                = i_detail
            EXCEPTIONS
              program_error           = 1
              OTHERS                  = 2.
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
      ENDCASE.
      ENDFORM.

    Run the SE30 with internal tables, then examine the top lines.
    see
    SE30
    The ABAP Runtime Trace (SE30) -  Quick and Easy
    Define you tables as sorted tables or use at least binary search, otherwise this sorts are useless
    and the nested loop is slow.
    SORT I_VBAKP BY OBJNR.
    SORT I_COEP BY OBJNR.
    LOOP AT I_WB.
    READ TABLE I_VBAKP WITH KEY OBJNR = I_WB-OBJNR.
    IF SY-SUBRC = 0.
    READ TABLE I_SECTOR WITH KEY KVGR5 = I_VBAKP-KVGR5.
    IF SY-SUBRC 0.
    DELETE I_COEP WHERE OBJNR = I_WB-OBJNR.
    loop at i_coep where objnr = i_wb-objnr.
    i_coep-kvgr5 = 'OTH'.
    modify i_coep.
    clear : i_coep.
    endloop.
    ELSE.
    READ TABLE I_COEP WITH KEY BELNR = I_WB-BELNR BUZEI = I_WB-BUZEI.
    READ TABLE I_COEP WITH KEY OBJNR = I_WB-OBJNR.
    IF SY-SUBRC = 0.
    I_COEP-KVGR5 = I_SECTOR-KVGR5.
    MODIFY I_COEP INDEX SY-TABIX.
    LOOP AT I_COEP WHERE OBJNR = I_WB-OBJNR.
    I_COEP-KVGR5 = I_SECTOR-KVGR5.
    MODIFY I_COEP.
    CLEAR : I_COEP.
    ENDLOOP.
    This is all very slow.
    Read my blog on internal tables:
    Measurements on internal tables: Reads and Loops:
    Runtimes of  Reads and Loops on Internal Tables
    If you really wnat to identify all bugs, then try this
    Z_SE30_COMPARE
    A Tool to Compare Runtime Measurements: Z_SE30_COMPARE
    Nonlinearity Check
    Nonlinearity Check Using the Z_SE30_COMPARE
    It needs at bit of experience but then it is very powerful!!!
    That is also a waste of time, but not a nested loop. You sort and resort the same table,
    but the sort is useless the deletes are still sequential on standard tables.
    Put all the stuff into ONE loop on I_COEP.
    SORT I_COEP BY OBJNR.
    DELETE I_COEP WHERE OBJNR+0(2) <> 'VB' AND
    OBJNR+0(2) <> 'PR' AND
    OBJNR+0(2) <> 'NV' AND
    OBJNR+0(2) <> 'NP' AND
    OBJNR+0(2) <> 'AO'.
    SORT I_COEP BY KSTAR.
    DELETE I_COEP WHERE KSTAR+0(5) <> '00003' AND
    KSTAR+0(5) <> '00004'.
    LOOP AT I_COEP WHERE OBJNR+0(2) = 'NP'.
    MOVE I_COEP TO I_NP.
    APPEND I_NP.
    CLEAR : I_NP, I_COEP.
    ENDLOOP.
    LOOP AT I_COEP WHERE OBJNR+0(2) = 'NV'.
    MOVE I_COEP TO I_NV.
    APPEND I_NV.
    CLEAR : I_NV, I_COEP.
    ENDLOOP.
    LOOP AT I_COEP WHERE OBJNR+0(2) = 'VB' .
    MOVE I_COEP TO I_WB.
    APPEND I_WB.
    CLEAR : I_WB, I_COEP.
    ENDLOOP.
    LOOP AT I_COEP WHERE OBJNR+0(2) = 'PR' .
    MOVE I_COEP TO I_PR.
    APPEND I_PR.
    CLEAR : I_PR, I_COEP.
    ENDLOOP.
    There is probably more. BBut with the compare tool you can find everything.
    Siegfried

  • Report Manager taking a long time to publish with Content Set that will pro

    Hi I am trying to publish 2 reports in report manager that each have multiple tabs. The are Exprense and Revenue Trend reports that will publish for each balancing segment, one years previous data. I can publish in pdf and html however not very pretty. Excel is taking too long and eventually crashed my session. Does anyone have any info on excel performance issues: The compents of teach FSG are as follows:
    Row Set
    Column Set
    Content set ( this provides the blanacing segment)
    Row Order
    Please help not long before go live.
    Thanks

    Please post the details of the application release, database version and OS.
    Please see these docs.
    Report Manager Taking Long Time To Produce Output In Excel. Flickering Occurs When the Output of an FSG Report data Being Populated In Excel. [ID 949300.1]
    Report Manager - Master Note [ID 726774.1]
    Poor Performance In HTML Due To FO Generator [ID 827288.1]
    Report Manager Troubleshooting [ID 858505.1]
    Thanks,
    Hussein

  • Currency translation taking more time at first time in the report

    Hi All,
    Here is an issue regarding the currency translation in the report. when we click on the currency translation from the contaxt menu on the report, its taking more time for the first time to get the selection options. But it is fast from the second time onwards. It will be not user friendly if its takes more time for the first time. Is there any way to fast up the processing time for the first time when i go for the "currency translation" option at report level for the first time.
    let me know why it takes more time for the first time when we go for this option at report level.
    Thanks,
    Jack

    Once again from the top.
    This is undoubtedly not a database issue.
    I doubt you can fix it in the database.
    You can, however, spend a lot of hours asking questions and poking around if you are a consultant paid by the hour.
    But as long as you are looking for something to do here are some that won't fix the problem but may be worth a few minutes of your time.
    WHERE 1 = 1Are you kidding? Drop this nonsense. The Oracle optimizer is not brain dead. If it were my database I would also drop the parallel hint like a bad habit.
    /*+ parallel(rp1, 8) */Again the Oracle optimizer is not brain dead. Ask for parallel threads that don't exist and the database will just queue your SQL and let it sit there until sufficient resources become available.

Maybe you are looking for

  • [SOLVED]Who controls LCD blanking?

    Hi I have ASUS k50ij, XFCE is installed as Desktop environment. After 10 minutes of inactivity i got a blank screen. I have disabled XFCE power manager, i have stoped acpid and laptop-mode-tools daemon, but i still get a blank screen after 10 minutes

  • My he 2000 laptop's screen shows only black screen, even if I tr

    Even if I try and hook it to a different monitor is there a fix for this?

  • Hello Experts

    Please help me on the below queries. What are the configurations done on XI, on R3, on XI's SLD, what is the protocol used for File, Content Conversion, Serialization? What kind of JDBC action was performed, DB accesed, driver installed?, Synch call

  • Initial installation in AD environment

    Hello, I would like to implement OS X Server in my Windows 2003 AD environment, specifically use the wiki and iChat server. I notice in the documentation you have 3 implementation options Standard Workgroup Advanced My vision is to only use the Wiki

  • Placing text inside curved shape

    i am having bit trouble placing the text inside this custom shape (i used custom shape tool) I followed one of the post found here Fitting text inside a custom shape but i couldn't get any results at all. Would someone maybe try to give me exact inst