Reduce Calc Time

Afternoon everyone,
We load data into our cube monthly, and when running the calc on the database it can take between 2/3 days to complete. I appreciate that calc time can be determined by a wide variety of factors (number of dense/spare dims/members etc) - but looking at things from a system resource view:
The server has 8 CPU's.
With total memory = 4194303 (according to server information within Application Manager)
When calcing, approx 1500000 of memory is used.
The start of the calc script defines the following parameters: 'SET CALCPARALLEL 4; SET UPDATECALC OFF;'
Would increasing the 'SET CALCPARALLEL' parameter from 4 to 6 be a viable approach to trying to reduce calc time (especially given the amount of available resource on the server)??
The server wont be used for anything else during the calc.

CL wrote:
Are you running 64 bit or 32 bit Essbase?
32 bit maxes out at 4 CPUs for parallel calc; 64 bit can go to 8.
You might want to look at the number of task dimensions set for parallel calculations.
See: http://download.oracle.com/docs/cd/E10530_01/doc/epm.931/html_esb_techref/calc/set_calctaskdims.htm
And your calculator cache is going to impact parallel calcs as well.
All of this can go up in smoke if you have calculations that require Essbase to calculate in serial, such as cross dimensionals.
There are lots of other possibilities re performance.
1) Could the SAN/local drives be faster?
2) Do you need to calc the whole database (I have no idea what your db is, only that you mention a monthly calc -- is it for just one month?)
3) Partitioning the db by month<--This is probably a really good place to look although nothing is free.
4) Going to ASO
There are others as well.
I appreciate that thie above four thoughts are beyond your question, they're just food for thought.
Regards,
Cameron LackpourASO should be an option. It is much much faster rollup than BSO.

Similar Messages

  • Reducing Calculation Times...

    Hi<BR><BR>I'm hoping this a fairly straight forward: I want to reduce the time it takes to complete an overnight batch.<BR><BR>Would reducing the block size (ie number of dense members) or reducing the no. of block (ie number of sparse members) have the greatest effect of reducing the calc time?<BR><BR>Thanks in advance<BR><BR>Mark

    Hi,<BR><BR>Thanks for your further replies.<BR><BR>The overnight batch performs an Input Level Data Export, Database Cleardown, Imports Data and an aggregation. We'd had problems with implied share. So we decided to mark all the parent nodes in the Sparse dimension as Never Share. This increased the stored members to the same number of members within the dimension. We'd had also removed some Dense members.<BR><BR>It seems that the effects of one netted out the benefits of another.<BR><BR>In my original post I was wondering if there is a ratio/balancing point on calc times based on the number of blocks and the size of blocks.<BR><BR>Apologies for not responding sooner.<BR><BR>Regards<BR><BR>Mark

  • Reducing Load Times / Design Architecture

    I'm designing a flash site with a Dynamic Gallery (loading images from a XML file). what can I do to reduce load time at the beginning, or limit loading times to individual images?
    I've seen designs which loads another SWF file on top of the current one. Is this feasible?
    Any details would be greatly appreciated.

    If loading the images is the goal of the file, then the quickest way to do that is to concentrate on the images.  Any way you load them, they have to be loaded.  Be sure they are optimized for the web.  If the gallery intent would allow for it, have the images loaded on request, using thumbnails or other button-like interfaces.  Or maybe load different sections at a time.  Or load so many at first, then load the rest in the background so that there's something to look at while the rest load.
    I don't know what purpose you have in mind for loading another swf into the file, so I can't offer any ideas there.

  • How to reduce process time in report

    Hi all..
    Is there any technique to reduce process time in report on programmer side??
    Plz help me...

    Hi
    check this and ensure that your code is as per the stds
    1) Dont use nested select statements
    2) If possible use for all entries in addition
    3) In the where addition make sure you give all the primary key
    4) Use Index for the selection criteria.
    5) You can also use inner joins
    6) You can try to put the data from the first select statement into an Itab and then in order to select the data from the second table use for all entries in.
    7) Use the runtime analysis SE30 and SQL Trace (ST05) to identify the performance and also to identify where the load is heavy, so that you can change the code accordingly
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5d0db4c9-0e01-0010-b68f-9b1408d5f234
    ABAP performance depends upon various factors and in devicded in three parts:
    1. Database
    2. ABAP
    3. System
    Run Any program using SE30 (performance analys) to improve performance refer to tips and trics section of SE30, Always remember that ABAP perfirmance is improved when there is least load on Database.
    u can get an interactive grap in SE30 regarding this with a file.
    also if u find runtime of parts of codes then use :
    Switch on RTA Dynamically within ABAP Code
    *To turn runtim analysis on within ABAP code insert the following code
    SET RUN TIME ANALYZER ON.
    *To turn runtim analysis off within ABAP code insert the following code
    SET RUN TIME ANALYZER OFF.
    Always check the driver internal tables is not empty, while using FOR ALL ENTRIES
    Avoid for all entries in JOINS
    Try to avoid joins and use FOR ALL ENTRIES.
    Try to restrict the joins to 1 level only ie only for tables
    Avoid using Select *.
    Avoid having multiple Selects from the same table in the same object.
    Try to minimize the number of variables to save memory.
    The sequence of fields in 'where clause' must be as per primary/secondary index ( if any)
    Avoid creation of index as far as possible
    Avoid operators like <>, > , < & like % in where clause conditions
    Avoid select/select single statements in loops.
    Try to use 'binary search' in READ internal table. Ensure table is sorted before using BINARY SEARCH.
    Avoid using aggregate functions (SUM, MAX etc) in selects ( GROUP BY , HAVING,)
    Avoid using ORDER BY in selects
    Avoid Nested Selects
    Avoid Nested Loops of Internal Tables
    Try to use FIELD SYMBOLS.
    Try to avoid into Corresponding Fields of
    Avoid using Select Distinct, Use DELETE ADJACENT
    Check the following Links
    Re: performance tuning
    Re: Performance tuning of program
    http://www.sapgenie.com/abap/performance.htm
    http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_PerformanceAnalysisTools.asp
    check the below link
    http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm
    See the following link if it's any help:
    http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_PerformanceAnalysisTools.asp
    Check also http://service.sap.com/performance
    and
    books like
    http://www.sap-press.com/product.cfm?account=&product=H951
    http://www.sap-press.com/product.cfm?account=&product=H973
    http://www.sap-img.com/abap/more-than-100-abap-interview-faqs.htm
    http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_PerformanceAnalysisTools.asp
    Performance tuning for Data Selection Statement
    http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm
    Debugger
    http://help.sap.com/saphelp_47x200/helpdata/en/c6/617ca9e68c11d2b2ab080009b43351/content.htm
    http://www.cba.nau.edu/haney-j/CIS497/Assignments/Debugging.doc
    http://help.sap.com/saphelp_erp2005/helpdata/en/b3/d322540c3beb4ba53795784eebb680/frameset.htm
    Run Time Analyser
    http://help.sap.com/saphelp_47x200/helpdata/en/c6/617cafe68c11d2b2ab080009b43351/content.htm
    SQL trace
    http://help.sap.com/saphelp_47x200/helpdata/en/d1/801f7c454211d189710000e8322d00/content.htm
    CATT - Computer Aided Testing Too
    http://help.sap.com/saphelp_47x200/helpdata/en/b3/410b37233f7c6fe10000009b38f936/frameset.htm
    Test Workbench
    http://help.sap.com/saphelp_47x200/helpdata/en/a8/157235d0fa8742e10000009b38f889/frameset.htm
    Coverage Analyser
    http://help.sap.com/saphelp_47x200/helpdata/en/c7/af9a79061a11d4b3d4080009b43351/content.htm
    Runtime Monitor
    http://help.sap.com/saphelp_47x200/helpdata/en/b5/fa121cc15911d5993d00508b6b8b11/content.htm
    Memory Inspector
    http://help.sap.com/saphelp_47x200/helpdata/en/a2/e5fc84cc87964cb2c29f584152d74e/content.htm
    ECATT - Extended Computer Aided testing tool.
    http://help.sap.com/saphelp_47x200/helpdata/en/20/e81c3b84e65e7be10000000a11402f/frameset.htm
    Just refer to these links...
    performance
    Performance
    Performance Guide
    performance issues...
    Performance Tuning
    Performance issues
    performance tuning
    performance tuning
    You can go to the transaction SE30 to have the runtime analysis of your program.Also try the transaction SCI , which is SAP Code Inspector.
    1 Always check the driver internal tables is not empty, while using FOR ALL ENTRIES
    2 Avoid for all entries in JOINS
    3 Try to avoid joins and use FOR ALL ENTRIES.
    4 Try to restrict the joins to 1 level only ie only for 2 tables
    5 Avoid using Select *.
    6 Avoid having multiple Selects from the same table in the same object.
    7 Try to minimize the number of variables to save memory.
    8 The sequence of fields in 'where clause' must be as per primary/secondary index ( if any)
    9 Avoid creation of index as far as possible
    10 Avoid operators like <>, > , < & like % in where clause conditions
    11 Avoid select/select single statements in loops.
    12 Try to use 'binary search' in READ internal table. Ensure table is sorted before using BINARY SEARCH.
    13 Avoid using aggregate functions (SUM, MAX etc) in selects ( GROUP BY , HAVING,)
    14 Avoid using ORDER BY in selects
    15 Avoid Nested Selects
    16 Avoid Nested Loops of Internal Tables
    17 Try to use FIELD SYMBOLS.
    18 Try to avoid into Corresponding Fields of
    19 Avoid using Select Distinct, Use DELETE ADJACENT.
    Regards
    Anji

  • Reducing the time interval in file Adpt to write a flat file at a location

    Hi All,
    I hav a scenario where i hav to write a flat file (<b>XXX.txt</b>) to a location. b4 doing that, i hav to check whether <b>XXX.txt</b> already exists or not. If it doesn't exists then i hav to write the <b>XXX.txt</b> file there. if it already exists, then i hav to wait until that <b>xxx.txt</b> file gets deleted.
    In the receiver file adapter v hav an option <b>file construction mode = <u><i>create</i></u></b> which does the same thing. but the problem here is it is taking too long (<b>more than 5 min</b>) which is not at all acceptable in my case (it is ok <b>if it takes 1 min</b>).
    Is there any way to <b>reduce the time interval</b> using the same option?
    Or do we hav any <b>work around solution</b> for acheiving the same scenario?
    any help wud b appreciated.
    Thnx in Adv.
    Anil

    Anil
    As far as my knowledge goes I think it is not possible because we are not going to do anything from our end. XI is doing processing and creating a file for you. But you might be sending a large file at a time. So you have to improve the performance in your scenario. You check this urls on how to improve performance in XI:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/70ada5ef-0201-0010-1f8b-c935e444b0ad
    Improving performence in XI
    Maximum Permitted File Size in XI
    ---Satish

  • How to reduce execution time ?

    Hi friends...
    I have created a report to display vendor opening balances,
    total debit ,total credit , total balance & closing balance for the given date range. it is working fine .But it takes more time to execute . How can I reduce execution time ?
    Plz help me. It's a very urgent report...
    The coding is as below.....
    report  yfiin_rep_vendordetail no standard page heading.
    tables : bsik,bsak,lfb1,lfa1.
    type-pools : slis .
    --TABLE STRUCTURE--
    types : begin of tt_bsik,
            bukrs type bukrs,
            lifnr type lifnr,
            budat type budat,
            augdt type augdt,
            dmbtr type dmbtr,
            wrbtr type wrbtr,
            shkzg type shkzg,
            hkont type hkont,
            bstat type bstat_d ,
            prctr type prctr,
            name1 type name1,
         end of tt_bsik,
         begin of tt_lfb1,
             lifnr type lifnr,
             mindk type mindk,
         end of tt_lfb1,
        begin of tt_lfa1,
            lifnr type lifnr,
            name1 type name1,
            ktokk type ktokk,
        end of tt_lfa1,
        begin of tt_opbal,
            bukrs type bukrs,
            lifnr type lifnr,
            gjahr type gjahr,
            belnr type belnr_d,
            budat type budat,
            bldat type bldat,
            waers type waers,
            dmbtr type dmbtr,
            wrbtr type wrbtr,
            shkzg type shkzg,
            blart type blart,
            monat type monat,
            hkont type hkont,
            bstat type bstat_d ,
            prctr type prctr,
            name1 type name1,
            tdr type  dmbtr,
            tcr type  dmbtr,
            tbal type  dmbtr,
          end of tt_opbal,
         begin of tt_bs ,
            bukrs type bukrs,
            lifnr type lifnr,
            name1 type name1,
            prctr type prctr,
            tbal type dmbtr,
            bala type dmbtr,
            balb type dmbtr,
            balc type dmbtr,
            bald type dmbtr,
            bale type dmbtr,
            gbal type dmbtr,
        end of tt_bs.
    ************WORK AREA DECLARATION *********************
    data :  gs_bsik type tt_bsik,
            gs_bsak type tt_bsik,
            gs_lfb1 type tt_lfb1,
            gs_lfa1 type tt_lfa1,
            gs_ageing  type tt_ageing,
            gs_bs type tt_bs,
            gs_opdisp type tt_bs,
            gs_final type tt_bsik,
            gs_opbal type tt_opbal,
            gs_opfinal type tt_opbal.
    ************INTERNAL TABLE DECLARATION*************
    data :  gt_bsik type standard table of tt_bsik,
            gt_bsak type standard table of tt_bsik,
            gt_lfb1 type standard table of tt_lfb1,
            gt_lfa1 type standard table of tt_lfa1,
            gt_ageing type standard table of tt_ageing,
            gt_bs type standard table of tt_bs,
            gt_opdisp type standard table of tt_bs,
            gt_final type standard table of tt_bsik,
            gt_opbal type standard table of tt_opbal,
            gt_opfinal type standard table of tt_opbal.
    ALV DECLARATIONS *******************
    data : gs_fcat type slis_fieldcat_alv ,
           gt_fcat type slis_t_fieldcat_alv ,
           gs_sort type slis_sortinfo_alv,
           gs_fcats type slis_fieldcat_alv ,
           gt_fcats type slis_t_fieldcat_alv.
    **********global data declration***************
    data :   kb type dmbtr ,
              return like  bapireturn ,
              balancespgli like  bapi3008-bal_sglind,
              noteditems like  bapi3008-ntditms_rq,
              keybalance type table of  bapi3008_3 with header line,
             opbalance type p.
    SELECTION SCREEN DECLARATIONS *********************
    selection-screen begin of block b1 with frame .
    select-options : so_bukrs for bsik-bukrs obligatory,
                     so_lifnr for bsik-lifnr,
                     so_hkont for bsik-hkont,
                     so_prctr for bsik-prctr ,
                     so_mindk for lfb1-mindk,
                     so_ktokk for lfa1-ktokk.
    selection-screen end of block b1.
    selection-screen : begin of block b1 with frame.
    parameters       : p_rb1 radiobutton group rad1 .
    select-options   : so_date for sy-datum .
    selection-screen : end of block b1.
    ********************************ASSIGNING ALV GRID
    ****field catalog for balance report
    gs_fcats-col_pos = 1.
    gs_fcats-fieldname = 'BUKRS'.
    gs_fcats-seltext_m =  text-001.
    append gs_fcats to gt_fcats .
    gs_fcats-col_pos = 2 .
    gs_fcats-fieldname = 'LIFNR'.
    gs_fcats-seltext_m = text-002.
    append gs_fcats to gt_fcats .
    gs_fcats-col_pos = 3.
    gs_fcats-fieldname = 'NAME1'.
    gs_fcats-seltext_m =  text-003.
    append gs_fcats to gt_fcats .
    gs_fcats-col_pos = 4.
    gs_fcats-fieldname = 'BALC'.
    gs_fcats-seltext_m =  text-016.
    append gs_fcats to gt_fcats .
    gs_fcats-col_pos = 5.
    gs_fcats-fieldname = 'BALA'.
    gs_fcats-seltext_m =  text-012.
    append gs_fcats to gt_fcats .
    gs_fcats-col_pos = 6.
    gs_fcats-fieldname = 'BALB'.
    gs_fcats-seltext_m =  text-013.
    append gs_fcats to gt_fcats .
    gs_fcats-col_pos = 7.
    gs_fcats-fieldname = 'TBAL'.
    gs_fcats-seltext_m =  text-014.
    append gs_fcats to gt_fcats .
    gs_fcats-col_pos = 8.
    gs_fcats-fieldname = 'GBAL'.
    gs_fcats-seltext_m =  text-015.
    append gs_fcats to gt_fcats .
    data : repid1 type sy-repid.
    repid1 = sy-repid.
    INITIALIZATION EVENTS ******************************
    initialization.
    *Clearing the work area.
    clear gs_bsik.
    Refreshing the internal tables.
    refresh gt_bsik.
    ******************START OF  SELECTION EVENTS **************************
    start-of-selection.
    *get data for balance report.
      perform sub_openbal.
      perform sub_openbal_display.
    *&      Form  sub_openbal
          text
    -->  p1        text
    <--  p2        text
    form sub_openbal .
      if   so_date-low > sy-datum or so_date-high > sy-datum .
          message i005(yfi02).
         leave screen.
    endif.
         select bukrs lifnr gjahr belnr budat bldat
           waers dmbtr wrbtr shkzg blart monat hkont prctr
           from bsik into table gt_opbal
           where bukrs in so_bukrs and lifnr in so_lifnr
           and hkont in so_hkont and prctr in so_prctr
           and budat in so_date .
        select bukrs lifnr gjahr belnr budat bldat
           waers dmbtr wrbtr shkzg blart monat hkont prctr
           from bsak appending table gt_opbal
           for all entries in gt_opbal
           where lifnr = gt_opbal-lifnr
           and budat in so_date .
    if sy-subrc <> 0.
      message i007(yfi02).
      leave screen.
      endif.
    select lifnr mindk from lfb1 into table gt_lfb1
      for all entries in gt_opbal
        where lifnr = gt_opbal-lifnr and mindk in so_mindk.
    select lifnr name1 ktokk from lfa1 into table gt_lfa1
      for all entries in gt_opbal
       where lifnr = gt_opbal-lifnr and ktokk in so_ktokk.
       loop at gt_opbal into gs_opbal .
         loop at gt_lfb1 into gs_lfb1 where lifnr = gs_opbal-lifnr.
           loop at gt_lfa1 into gs_lfa1 where lifnr = gs_opbal-lifnr.
            gs_opfinal-bukrs = gs_opbal-bukrs.
            gs_opfinal-lifnr = gs_opbal-lifnr.
            gs_opfinal-gjahr = gs_opbal-gjahr.
            gs_opfinal-belnr = gs_opbal-belnr.
            gs_opfinal-budat = gs_opbal-budat.
            gs_opfinal-bldat = gs_opbal-bldat.
            gs_opfinal-waers = gs_opbal-waers.
            gs_opfinal-dmbtr = gs_opbal-dmbtr.
            gs_opfinal-wrbtr = gs_opbal-wrbtr.
            gs_opfinal-shkzg = gs_opbal-shkzg.
            gs_opfinal-blart = gs_opbal-blart.
            gs_opfinal-monat = gs_opbal-monat.
            gs_opfinal-hkont = gs_opbal-hkont.
            gs_opfinal-prctr = gs_opbal-prctr.
            gs_opfinal-name1 = gs_lfa1-name1.
        if gs_opbal-shkzg    = 'H'.
            gs_opfinal-tcr   =  gs_opbal-dmbtr * -1.
            gs_opfinal-tdr   =  '000000'.
        else.
            gs_opfinal-tdr   =  gs_opbal-dmbtr.
            gs_opfinal-tcr   =  '000000'.
        endif.
           append gs_opfinal to gt_opfinal.
           endloop.
           endloop.
           endloop.
    sort gt_opfinal by bukrs lifnr prctr .
    so_date-low = so_date-low - 1 .
    loop at gt_opfinal into gs_opfinal.
    call function 'BAPI_AP_ACC_GETKEYDATEBALANCE'
      exporting
        companycode        = gs_opfinal-bukrs
        vendor             =  gs_opfinal-lifnr
        keydate            = so_date-low
       balancespgli        = ' '
       noteditems          = ' '
      importing
        return             = return
      tables
        keybalance         = keybalance.
    clear kb .
    loop at keybalance .
       kb = keybalance-lc_bal + kb .
    endloop.
          gs_opdisp-balc = kb.
          gs_opdisp-bukrs =  gs_opfinal-bukrs.
          gs_opdisp-lifnr =  gs_opfinal-lifnr.
          gs_opdisp-name1 =  gs_opfinal-name1.
        at new lifnr .
          sum .
          gs_opfinal-tbal =  gs_opfinal-tdr + gs_opfinal-tcr  .
          gs_opdisp-tbal = gs_opfinal-tbal.
          gs_opdisp-bala = gs_opfinal-tdr .
          gs_opdisp-balb = gs_opfinal-tcr .
          gs_opdisp-gbal = keybalance-lc_bal + gs_opfinal-tbal .
          append gs_opdisp to gt_opdisp.
        endat.
        clear gs_opdisp.
        clear keybalance .
      endloop.
      delete adjacent duplicates from gt_opdisp.
    endform.                    " sub_openbal
    *&      Form  sub_openbal_display
          text
    -->  p1        text
    <--  p2        text
    form sub_openbal_display .
    call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
          i_callback_program              =  repid1
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
          it_fieldcat                     = gt_fcats
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = 'X'
      IS_VARIANT                        =
       it_events                        =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      I_HTML_HEIGHT_TOP                 =
      I_HTML_HEIGHT_END                 =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
         tables
           t_outtab                       = gt_opdisp
      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.                    " sub_openbal_display

    I think you are using for all entries statement in almost all select statements but i didnt see any condtion before you are using for all entries statement.
    If you are using for all entries in gt_opbal ... make sure that gt_opbal has some records other wise it will try to read all records from the data base tables.
    Try to check before using for all entries in the select statement like
    if gt_opbal is not initial.
    select adfda adfadf afdadf into table
      for all entries in gt_opbal.
    else.
    select abdf afad into table
    from abcd
    where a = 1
        and b = 2.
    endif.
    i didnt see anything wrong in your report but this is major time consuming when you dont have records in the table which you are using for all entries.

  • How to reduce performance time.

    Hi,
    Any body guide me how to reduce performance time for this report.
    It’s taking to much time for execution.
    *& Report  ZEOU_CST_CLAIM_REP                                          *
    REPORT  zeou_cst_claim_rep.
    *& Program Name    : ZEOU_CST_CLAIM_REP                                *
    *& Title           : CST Claim Report                                  *
    *& Module Name     : EOU                                               *
    *& Author          : Chandra Vangoor                                   *
    *& Create Date     : 05.05.2006                                        *
    *& Logical DB      : None                                              *
    *& Program Type    : On-Line.                                          *
    *& SAP Release     : 4.7                                               *
    *& Description     :                                                   *
    *& Log    Date    Author        Reason of change
    TABLES
    TABLES : a363,
             mara,
             marc,
             makt,
             ekko,
             ekpo,
             mkpf,
             mseg,
             konp,
             konh.
    SELECTION-SCREEN
    SELECTION-SCREEN   :   BEGIN OF BLOCK cst WITH FRAME TITLE text-001.
    SELECT-OPTIONS :   s_matnr FOR mara-matnr,                            "Material Number
                       s_lifnr FOR ekko-lifnr,                            "Account Number of the Vendor
                       s_bedat FOR ekko-bedat,                            "Purchasing Document Date
                       s_kschl FOR konh-kschl OBLIGATORY NO INTERVALS,    "Condition type
                       s_bwart FOR mseg-bwart OBLIGATORY NO INTERVALS.    "Movement Type (Inventory Management)
    PARAMETERS     :   p_werks LIKE marc-werks OBLIGATORY.                "Plant
    SELECTION-SCREEN   :   END OF BLOCK cst.
    INCLUDES
    INCLUDE zalv_data.
    DATA - INTERNAL TABLES AND FIELD LISTS
    DATA :  BEGIN    OF     a363_itab  OCCURS 0,
            matnr    LIKE   a363-matnr,                    "Material Number
            lifnr    LIKE   a363-lifnr,                    "Account Number of the Vendor
            werks    LIKE   a363-werks,                    "Plant
            kschl    LIKE   a363-kschl,                    "Condition type
            knumh    LIKE   a363-knumh,                    "Condition record number
            kbetr    LIKE   konp-kbetr,                    "Rate (condition amount or percentage) where no scale exists
            END      OF     a363_itab.
    DATA :  BEGIN    OF     konp_itab  OCCURS 0,
            knumh    LIKE   a363-knumh,                    "Condition record number
            kbetr    LIKE   konp-kbetr,                    "Rate (condition amount or percentage) where no scale exists
            lifnr    LIKE   a363-lifnr,                    "Account Number of the Vendor
            END      OF     konp_itab.
    DATA :  BEGIN    OF     ekko_itab  OCCURS 0,
            ebeln    LIKE   ekko-ebeln,                    "Purchasing Document Number
            lifnr    LIKE   ekko-lifnr,                    "Account Number of the Vendor
            bedat    LIKE   ekko-bedat,                    "Purchasing Document Date
            END      OF     ekko_itab.
    DATA :  BEGIN    OF     ekpo_itab  OCCURS 0,
            ebeln    LIKE   ekpo-ebeln,                    "Purchasing Document Number
            ebelp    LIKE   ekpo-ebelp,                    "Item Number of Purchasing Document
            matnr    LIKE   ekpo-matnr,                    "Material Number
            werks    LIKE   ekpo-werks,                    "Plant
            menge    LIKE   ekpo-menge,                    "Purchase order quantity
            END      OF     ekpo_itab.
    DATA :  BEGIN    OF     v_po_det  OCCURS 0,            "VENDOR + PLANT + PO DEATILS
            lifnr    LIKE   ekko-lifnr,                    "Account Number of the Vendor
            ebeln    LIKE   ekko-ebeln,                    "Purchasing Document Number
            ebelp    LIKE   ekpo-ebelp,                    "Item Number of Purchasing Document
            bedat    LIKE   ekko-bedat,                    "Purchasing Document Date
            matnr    LIKE   ekpo-matnr,                    "Material Number
            werks    LIKE   ekpo-werks,                    "Plant
            menge    LIKE   ekpo-menge,                    "Purchase order quantity
            kbetr    LIKE   konp-kbetr,                    "Rate (condition amount or percentage) where no scale exists
            END      OF     v_po_det.
    DATA :  BEGIN    OF     mseg_itab  OCCURS 0,
            mblnr    LIKE   mseg-mblnr,                    "Number of Material Document
            ebeln    LIKE   mseg-ebeln,                    "Purchasing Document Number
            ebelp    LIKE   mseg-ebelp,                    "Item Number of Purchasing Document
            matnr    LIKE   mseg-matnr,                    "Material Number
            lifnr    LIKE   mseg-lifnr,                    "Account Number of the Vendor
            werks    LIKE   mseg-werks,                    "Plant
            menge    LIKE   mseg-menge,                    "Quantity
            dmbtr    LIKE   mseg-dmbtr,                    "Amount in local currency
            bwart    LIKE   mseg-bwart,                    "Movement Type (Inventory Management)
            END      OF     mseg_itab.
    DATA :  BEGIN    OF     mkpf_itab  OCCURS 0,
            mblnr    LIKE   mkpf-mblnr,                    "Number of Material Document
            bldat    LIKE   mkpf-bldat,                    "Document Date in Document
            END      OF     mkpf_itab.
    DATA :  BEGIN    OF     zeou_pcrdtl_itab  OCCURS 0,
            matnr    LIKE   zeou_pcrdtl-matnr,             "Material Number
            lifnr    LIKE   zeou_pcrdtl-lifnr,             "Account Number of the Vendor
            mblnr    LIKE   zeou_pcrdtl-mblnr,             "Number of Material Document
            whssn    LIKE   zeou_pcrdtl-whssn,             "Warehouse Records Entry Serial No.
            whsdt    LIKE   zeou_pcrdtl-whsdt,             "Warehouse Records Entry date
            END      OF     zeou_pcrdtl_itab.
    DATA :  BEGIN    OF     gr_wh_info  OCCURS 0,          "INFO OF GR & WH BASED ON MVMT TYPE & PO
            mblnr    LIKE   mseg-mblnr,                    "Number of Material Document
            bldat    LIKE   mkpf-bldat,                    "Document Date in Document
            ebeln    LIKE   mseg-ebeln,                    "Purchasing Document Number
            ebelp    LIKE   ekpo-ebelp,                    "Item Number of Purchasing Document
            matnr    LIKE   mseg-matnr,                    "Material Number
            lifnr    LIKE   mseg-lifnr,                    "Account Number of the Vendor
            werks    LIKE   mseg-werks,                    "Plant
            menge    LIKE   mseg-menge,                    "Quantity
            dmbtr    LIKE   mseg-dmbtr,                    "Amount in local currency
            bwart    LIKE   mseg-bwart,                    "Movement Type (Inventory Management)
            whssn    LIKE   zeou_pcrdtl-whssn,             "Warehouse Records Entry Serial No.
            whsdt    LIKE   zeou_pcrdtl-whsdt,             "Warehouse Records Entry date
            END      OF     gr_wh_info.
    DATA :  BEGIN    OF     bseg_itab  OCCURS 0,
            ebeln    LIKE   bseg-ebeln,                    "Purchasing Document Number
            ebelp    LIKE   bseg-ebelp,                    "Item Number of Purchasing Document
            matnr    LIKE   bseg-matnr,                    "Material Number
            lifnr    LIKE   bseg-lifnr,                    "Account Number of the Vendor
            werks    LIKE   bseg-werks,                    "Plant
            buzid    LIKE   bseg-buzid,                    "Identification of the Line Item
            bschl    LIKE   bseg-bschl,                    "Posting Key
            wrbtr    LIKE   bseg-wrbtr,                    "Amount in document currency
            bukrs    LIKE   bseg-bukrs,                    "Company Code
            belnr    LIKE   bseg-belnr,                    "Accounting Document Number
            gjahr    LIKE   bseg-gjahr,                    "Fiscal Year
            END      OF     bseg_itab.
    DATA :  BEGIN    OF     bkpf_itab  OCCURS 0,
            bukrs    LIKE   bkpf-bukrs,                    "Company Code
            belnr    LIKE   bkpf-belnr,                    "Accounting Document Number
            gjahr    LIKE   bkpf-gjahr,                    "Fiscal Year
            xblnr    LIKE   bkpf-xblnr,                    "Reference Document Number
            bldat    LIKE   bkpf-bldat,                    "Document Date in Document
            END      OF     bkpf_itab.
    DATA :  BEGIN    OF     vend_inv  OCCURS 0,            "VENDOR INVOICE DETAILS
            ebeln    LIKE   bseg-ebeln,                    "Purchasing Document Number
            ebelp    LIKE   bseg-ebelp,                    "Item Number of Purchasing Document
            matnr    LIKE   bseg-matnr,                    "Material Number
            lifnr    LIKE   bseg-lifnr,                    "Account Number of the Vendor
            werks    LIKE   bseg-werks,                    "Plant
            buzid    LIKE   bseg-buzid,                    "Identification of the Line Item
            bschl    LIKE   bseg-bschl,                    "Posting Key
            wrbtr    LIKE   bseg-wrbtr,                    "Amount in document currency
            bukrs    LIKE   bseg-bukrs,                    "Company Code
            belnr    LIKE   bseg-belnr,                    "Accounting Document Number
            gjahr    LIKE   bseg-gjahr,                    "Fiscal Year
            xblnr    LIKE   bkpf-xblnr,                    "Reference Document Number
            bldat    LIKE   bkpf-bldat,                    "Document Date in Document
            END      OF     vend_inv.
    DATA :  BEGIN    OF     chckinit  OCCURS 0,            "CHEQUE INIT INFO
            ebeln    LIKE   bseg-ebeln,                    "Purchasing Document Number
            ebelp    LIKE   bseg-ebelp,                    "Item Number of Purchasing Document
            matnr    LIKE   bseg-matnr,                    "Material Number
            lifnr    LIKE   bseg-lifnr,                    "Account Number of the Vendor
            werks    LIKE   bseg-werks,                    "Plant
            buzid    LIKE   bseg-buzid,                    "Identification of the Line Item
            bschl    LIKE   bseg-bschl,                    "Posting Key
            bukrs    LIKE   bkpf-bukrs,                    "Company Code
            belnr    LIKE   bkpf-belnr,                    "Accounting Document Number
            gjahr    LIKE   bkpf-gjahr,                    "Fiscal Year
            koart    LIKE   bseg-koart,                    "Account type
            augbl    LIKE   bseg-augbl,                    "Document Number of the Clearing Document
            END      OF     chckinit.
    DATA :  BEGIN    OF     chckpayer  OCCURS 0,           "CHEQUE BANK DETAILS
            vblnr    LIKE   payr-vblnr,                    "Document Number of the Payment Document
            zbukr    LIKE   payr-zbukr,                    "Paying company code
            gjahr    LIKE   payr-gjahr,                    "Fiscal Year
            chect    LIKE   payr-chect,                    "Check Number
            zaldt    LIKE   payr-zaldt,                    "Probable Payment Date (Cash Discount 1 Due)
            hbkid    LIKE   payr-hbkid,                    "Short key for a house bank
            END      OF     chckpayer.
    DATA :  chckpayer_u LIKE chckpayer OCCURS 0 WITH HEADER LINE.      "UNIQUE CHEQUE DETAILS
    DATA :  BEGIN    OF     chckfinal  OCCURS 0,           "CHEQUE FINAL INFO
            ebeln    LIKE   bseg-ebeln,                    "Purchasing Document Number
            ebelp    LIKE   bseg-ebelp,                    "Item Number of Purchasing Document
            matnr    LIKE   bseg-matnr,                    "Material Number
            lifnr    LIKE   bseg-lifnr,                    "Account Number of the Vendor
            werks    LIKE   bseg-werks,                    "Plant
            buzid    LIKE   bseg-buzid,                    "Identification of the Line Item
            bschl    LIKE   bseg-bschl,                    "Posting Key
            bukrs    LIKE   bkpf-bukrs,                    "Company Code
            belnr    LIKE   bkpf-belnr,                    "Accounting Document Number
            gjahr    LIKE   bkpf-gjahr,                    "Fiscal Year
            koart    LIKE   bseg-koart,                    "Account type
            augbl    LIKE   bseg-augbl,                    "Document Number of the Clearing Document
            vblnr    LIKE   payr-vblnr,                    "Document Number of the Payment Document
            zbukr    LIKE   payr-zbukr,                    "Paying company code
            chect    LIKE   payr-chect,                    "Check Number
            zaldt    LIKE   payr-zaldt,                    "Probable Payment Date (Cash Discount 1 Due)
            hbkid    LIKE   payr-hbkid,                    "Short key for a house bank
            END      OF     chckfinal.
    DATA :  BEGIN    OF     mat_desc OCCURS 0,
            matnr    LIKE   mara-matnr,
            maktx    LIKE   makt-maktx,
            END      OF     mat_desc.
    DATA :  BEGIN      OF     vend_det OCCURS 0,
            lifnr      LIKE   lfa1-lifnr,
            name1      LIKE   lfa1-name1,
            j_1icstno  LIKE   j_1imovend-j_1icstno,
            END        OF     vend_det.
    DATA :  BEGIN    OF     cst_rep  OCCURS 0,             "FINAL CST REPORT
            lifnr    LIKE   a363-lifnr,                    "Account Number of the Vendor
            name1    LIKE   lfa1-name1,                    "Vendor Name
            j_1icstno  LIKE   j_1imovend-j_1icstno,        " Vendor CST No.
            werks    LIKE   a363-werks,                    "Plant
           kschl    LIKE   a363-kschl,                    "Condition type
            ebeln    LIKE   ekko-ebeln,                    "Purchasing Document Number
            ebelp    LIKE   ekpo-ebelp,                    "Item Number of Purchasing Document
            bedat    LIKE   ekko-bedat,                    "Purchasing Document Date
            matnr    LIKE   ekpo-matnr,                    "Material Number
            maktx    LIKE   makt-maktx,                    "Material Description.
            kbetr    LIKE   konp-kbetr,                    "Rate (condition amount or percentage) where no scale exists
            mblnr    LIKE   mseg-mblnr,                    "Number of Material Document
            bldat    LIKE   mkpf-bldat,                    "Document Date in Document
            menge    LIKE   mseg-menge,                    "Quantity
            dmbtr    LIKE   mseg-dmbtr,                    "Amount in local currency
            cst_dmbtr LIKE  mseg-dmbtr,                    "CST Amount in local currency
            bwart    LIKE   mseg-bwart,                    "Movement Type (Inventory Management)
            whssn    LIKE   zeou_pcrdtl-whssn,             "Warehouse Records Entry Serial No.
            whsdt    LIKE   zeou_pcrdtl-whsdt,             "Warehouse Records Entry date
            buzid    LIKE   bseg-buzid,                    "Identification of the Line Item
            bschl    LIKE   bseg-bschl,                    "Posting Key
            wrbtr    LIKE   bseg-wrbtr,                    "Amount in document currency
            cst_wrbtr LIKE  bseg-wrbtr,                    "CST Amount in document currency
            belnr    LIKE   bseg-belnr,                    "Accounting Document Number
            gjahr    LIKE   bseg-gjahr,                    "Fiscal Year
            xblnr    LIKE   bkpf-xblnr,                    "Reference Document Number
            koart    LIKE   bseg-koart,                    "Account type
            augbl    LIKE   bseg-augbl,                    "Document Number of the Clearing Document
            vblnr    LIKE   payr-vblnr,                    "Document Number of the Payment Document
            zbukr    LIKE   payr-zbukr,                    "Paying company code
            chect    LIKE   payr-chect,                    "Check Number
            zaldt    LIKE   payr-zaldt,                    "Probable Payment Date (Cash Discount 1 Due)
            hbkid    LIKE   payr-hbkid,                    "Short key for a house bank
            END      OF     cst_rep.
    DATA :  BEGIN    OF     gt_output  OCCURS 0,              "ALV OUTPUT
            slno     LIKE   sy-tabix,                      "Serial Number
            lifnr    LIKE   a363-lifnr,                    "Account Number of the Vendor
            name1    LIKE   lfa1-name1,                    "Vendor Name
            j_1icstno  LIKE   j_1imovend-j_1icstno,        " Vendor CST No.
            werks    LIKE   a363-werks,                    "Plant
           kschl    LIKE   a363-kschl,                    "Condition type
            ebeln    LIKE   ekko-ebeln,                    "Purchasing Document Number
            ebelp    LIKE   ekpo-ebelp,                    "Item Number of Purchasing Document
            bedat    LIKE   ekko-bedat,                    "Purchasing Document Date
            matnr    LIKE   ekpo-matnr,                    "Material Number
            maktx    LIKE   makt-maktx,                    "Material Description
            mblnr    LIKE   mseg-mblnr,                    "Number of Material Document
            bldat    LIKE   mkpf-bldat,                    "Document Date in Document
            menge    LIKE   mseg-menge,                    "Quantity
            dmbtr    LIKE   mseg-dmbtr,                    "Amount in local currency
            cst_dmbtr LIKE  mseg-dmbtr,                    "CST Amount in local currency
            bwart    LIKE   mseg-bwart,                    "Movement Type (Inventory Management)
            whssn    LIKE   zeou_pcrdtl-whssn,             "Warehouse Records Entry Serial No.
            whsdt    LIKE   zeou_pcrdtl-whsdt,             "Warehouse Records Entry date
            buzid    LIKE   bseg-buzid,                    "Identification of the Line Item
            bschl    LIKE   bseg-bschl,                    "Posting Key
            wrbtr    LIKE   bseg-wrbtr,                    "Amount in document currency
            cst_wrbtr LIKE  bseg-wrbtr,                    "CST Amount in document currency
            belnr    LIKE   bseg-belnr,                    "Accounting Document Number
            gjahr    LIKE   bseg-gjahr,                    "Fiscal Year
            xblnr    LIKE   bkpf-xblnr,                    "Reference Document Number
            koart    LIKE   bseg-koart,                    "Account type
            augbl    LIKE   bseg-augbl,                    "Document Number of the Clearing Document
            vblnr    LIKE   payr-vblnr,                    "Document Number of the Payment Document
            zbukr    LIKE   payr-zbukr,                    "Paying company code
            chect    LIKE   payr-chect,                    "Check Number
            zaldt    LIKE   payr-zaldt,                    "Probable Payment Date (Cash Discount 1 Due)
            hbkid    LIKE   payr-hbkid,                    "Short key for a house bank
            usr_txt1(20) TYPE c,
            usr_txt2(20) TYPE c,
            END      OF     gt_output.
    *Working Variables
    DATA : cst_gr  LIKE  mseg-dmbtr,
           cst_inv LIKE  bseg-wrbtr,
           usr_txt1(20) TYPE c,
           usr_txt2(20) TYPE c.
    START-OF-SELECTION.
    *Retreiving Data from a363 table for the given input
      SELECT  matnr
              lifnr
              werks
              kschl
              knumh
              FROM a363
              INTO TABLE a363_itab
              WHERE matnr IN s_matnr AND lifnr IN s_lifnr AND werks EQ p_werks AND kschl IN s_kschl.
    *rakesh ***************************
    SELECT  *
             FROM konp
             INTO CORRESPONDING FIELDS OF TABLE konp_itab
             FOR ALL ENTRIES IN a363_itab
             WHERE knumh EQ a363_itab-knumh.
      IF  a363_itab[] IS NOT INITIAL.
        SELECT knumh
               kbetr
               lifnr
               FROM konp INTO TABLE konp_itab
               FOR ALL ENTRIES IN a363_itab
               WHERE knumh EQ a363_itab-knumh.
      ENDIF.
      LOOP AT a363_itab.
        READ TABLE konp_itab WITH KEY knumh = a363_itab-knumh.
        IF sy-subrc EQ 0.
          MOVE : konp_itab-kbetr TO a363_itab-kbetr.
          MODIFY a363_itab.
        ENDIF.
        CLEAR : a363_itab, konp_itab.
      ENDLOOP.
    rakesh****************************
    SELECT *
            FROM makt
            INTO CORRESPONDING FIELDS OF TABLE mat_desc
            FOR ALL ENTRIES IN a363_itab
            WHERE matnr EQ a363_itab-matnr.
      SELECT matnr
             maktx
             FROM makt INTO TABLE mat_desc
             FOR ALL ENTRIES IN a363_itab
             WHERE matnr EQ a363_itab-matnr.
      SELECT a~lifnr
             a~name1
             b~j_1icstno
             INTO TABLE vend_det
             FROM lfa1 AS a JOIN j_1imovend AS b
             ON alifnr EQ blifnr
             FOR ALL ENTRIES IN a363_itab
             WHERE a~lifnr EQ a363_itab-lifnr.
    Retreiving Data from EKKO & EKPO table for the given input
    And Populating the V_PO_DETAILS itab
    SELECT  *
             FROM ekko
             INTO CORRESPONDING FIELDS OF TABLE ekko_itab
             FOR ALL ENTRIES IN a363_itab
             WHERE lifnr EQ a363_itab-lifnr AND bedat IN s_bedat.
      IF  a363_itab[] IS NOT INITIAL.
        SELECT ebeln
               lifnr
               bedat
               FROM ekko INTO TABLE ekko_itab
               FOR ALL ENTRIES IN a363_itab
                WHERE lifnr EQ a363_itab-lifnr AND bedat IN s_bedat.
      ENDIF.
    SELECT  *
             FROM ekpo
             INTO CORRESPONDING FIELDS OF TABLE ekpo_itab
             FOR ALL ENTRIES IN a363_itab
             WHERE matnr EQ a363_itab-matnr AND werks EQ a363_itab-werks AND mwskz NE 'V0'.
      IF  a363_itab[] IS NOT INITIAL.
        SELECT ebeln
               ebelp
               matnr
               werks
               menge
               FROM ekpo INTO TABLE ekpo_itab
               FOR ALL ENTRIES IN a363_itab
               WHERE matnr EQ a363_itab-matnr AND werks EQ a363_itab-werks AND mwskz NE 'V0'.
      ENDIF.
      LOOP AT ekpo_itab.
        MOVE :   ekpo_itab-ebelp TO v_po_det-ebelp,
                 ekpo_itab-matnr TO v_po_det-matnr,
                 ekpo_itab-werks TO v_po_det-werks,
                 ekpo_itab-menge TO v_po_det-menge.
        READ TABLE ekko_itab WITH KEY ebeln = ekpo_itab-ebeln.
        IF sy-subrc EQ 0.
          MOVE  :  ekko_itab-lifnr TO v_po_det-lifnr,
                   ekko_itab-ebeln TO v_po_det-ebeln,
                   ekko_itab-bedat TO v_po_det-bedat.
          APPEND : v_po_det.
        ENDIF.
        CLEAR  : ekko_itab, ekpo_itab, v_po_det.
      ENDLOOP.
      LOOP AT v_po_det.
        READ TABLE a363_itab WITH KEY matnr = v_po_det-matnr lifnr = v_po_det-lifnr werks = v_po_det-werks.
        IF sy-subrc EQ 0.
          MOVE : a363_itab-kbetr TO v_po_det-kbetr.
          MODIFY v_po_det.
        ENDIF.
        CLEAR : a363_itab, v_po_det.
      ENDLOOP.
    Retreiving Data from MKPF & MSEG & ZEOU_PCRDTL table for the given input
    And Populating the GR_WH_info itab
    SELECT  *
             FROM mseg
             INTO CORRESPONDING FIELDS OF TABLE mseg_itab
             FOR ALL ENTRIES IN v_po_det
             WHERE ebeln EQ v_po_det-ebeln AND matnr EQ v_po_det-matnr AND bwart IN s_bwart.
      IF v_po_det[] IS NOT INITIAL.
        SELECT mblnr
               ebeln
               ebelp
               matnr
               lifnr
               werks
               menge
               dmbtr
               bwart
               FROM mseg INTO TABLE mseg_itab
               FOR ALL ENTRIES IN v_po_det
               WHERE ebeln EQ v_po_det-ebeln AND matnr EQ v_po_det-matnr AND bwart IN s_bwart.
      ENDIF.
      IF mseg_itab[] IS NOT INITIAL.
    SELECT  *
             FROM mkpf
             INTO CORRESPONDING FIELDS OF TABLE mkpf_itab
             FOR ALL ENTRIES IN mseg_itab
             WHERE mblnr EQ mseg_itab-mblnr.
        SELECT  mblnr
                bldat
                FROM mkpf INTO TABLE mkpf_itab
                FOR ALL ENTRIES IN mseg_itab
                WHERE mblnr EQ mseg_itab-mblnr.
      SELECT  *
             FROM zeou_pcrdtl
             INTO CORRESPONDING FIELDS OF TABLE zeou_pcrdtl_itab
             FOR ALL ENTRIES IN mseg_itab
             WHERE mblnr EQ mseg_itab-mblnr AND matnr EQ mseg_itab-matnr.
        SELECT matnr
               lifnr
               mblnr
               whssn
               whsdt
               FROM zeou_pcrdtl INTO TABLE zeou_pcrdtl_itab
                 FOR ALL ENTRIES IN mseg_itab
                 WHERE mblnr EQ mseg_itab-mblnr AND matnr EQ mseg_itab-matnr.
      ENDIF.
      LOOP AT mseg_itab.
        MOVE  :  mseg_itab-mblnr TO gr_wh_info-mblnr,
                 mseg_itab-ebeln TO gr_wh_info-ebeln,
                 mseg_itab-ebelp TO gr_wh_info-ebelp,
                 mseg_itab-matnr TO gr_wh_info-matnr,
                 mseg_itab-lifnr TO gr_wh_info-lifnr,
                 mseg_itab-werks TO gr_wh_info-werks,
                 mseg_itab-menge TO gr_wh_info-menge,
                 mseg_itab-dmbtr TO gr_wh_info-dmbtr,
                 mseg_itab-bwart TO gr_wh_info-bwart.
        READ TABLE mkpf_itab WITH KEY mblnr = mseg_itab-mblnr.
        IF sy-subrc EQ 0.
          MOVE  :  mkpf_itab-bldat TO gr_wh_info-bldat.
        ENDIF.
        READ TABLE zeou_pcrdtl_itab WITH KEY mblnr = mseg_itab-mblnr.
        IF sy-subrc EQ 0.
          MOVE  :  zeou_pcrdtl_itab-whssn TO gr_wh_info-whssn,
                   zeou_pcrdtl_itab-whsdt TO gr_wh_info-whsdt.
        ENDIF.
        APPEND : gr_wh_info.
        CLEAR : mseg_itab, mkpf_itab, gr_wh_info.
      ENDLOOP.
    Retreiving Data from BSEG & BKPF table
    And Populating the Vendor Invoice Details
      IF v_po_det[] IS NOT INITIAL.
    SELECT  *
             FROM bseg
             INTO CORRESPONDING FIELDS OF TABLE bseg_itab
             FOR ALL ENTRIES IN v_po_det
             WHERE ebeln EQ v_po_det-ebeln AND matnr EQ v_po_det-matnr AND buzid EQ 'W' AND bschl EQ '96'.
        SELECT  ebeln
                ebelp
                matnr
                lifnr
                werks
                buzid
                bschl
                wrbtr
                bukrs
                belnr
                gjahr
                FROM bseg INTO TABLE bseg_itab
                  FOR ALL ENTRIES IN v_po_det
                  WHERE ebeln EQ v_po_det-ebeln AND matnr EQ v_po_det-matnr AND buzid EQ 'W' AND bschl EQ '96'.
      ENDIF.
      IF bseg_itab[] IS NOT INITIAL.
    SELECT  *
             FROM bkpf
             INTO CORRESPONDING FIELDS OF TABLE bkpf_itab
             FOR ALL ENTRIES IN bseg_itab
             WHERE bukrs EQ bseg_itab-bukrs AND belnr EQ bseg_itab-belnr AND gjahr EQ bseg_itab-gjahr.
        SELECT  bukrs
                belnr
                gjahr
                xblnr
                bldat
                FROM bkpf INTO TABLE bkpf_itab
                FOR ALL ENTRIES IN bseg_itab
                WHERE bukrs EQ bseg_itab-bukrs AND belnr EQ bseg_itab-belnr AND gjahr EQ bseg_itab-gjahr.
      ENDIF.
      LOOP AT bseg_itab.
        MOVE  :  bseg_itab-ebeln TO vend_inv-ebeln,
                 bseg_itab-ebelp TO vend_inv-ebelp,
                 bseg_itab-matnr TO vend_inv-matnr,
                 bseg_itab-lifnr TO vend_inv-lifnr,
                 bseg_itab-werks TO vend_inv-werks,
                 bseg_itab-buzid TO vend_inv-buzid,
                 bseg_itab-bschl TO vend_inv-bschl,
                 bseg_itab-wrbtr TO vend_inv-wrbtr,
                 bseg_itab-bukrs TO vend_inv-bukrs,
                 bseg_itab-belnr TO vend_inv-belnr,
                 bseg_itab-gjahr TO vend_inv-gjahr.
        READ TABLE bkpf_itab WITH KEY bukrs = bseg_itab-bukrs belnr = bseg_itab-belnr gjahr = bseg_itab-gjahr.
        IF sy-subrc EQ 0.
          MOVE  :  bkpf_itab-xblnr TO vend_inv-xblnr,
                   bkpf_itab-bldat TO vend_inv-bldat.
          APPEND  :  vend_inv.
        ENDIF.
        CLEAR : vend_inv, bseg_itab, bkpf_itab.
      ENDLOOP.
    Retreiving Data from BSEG & BKPF table
    And Populating the Cheque Info Details
      IF v_po_det[] IS NOT INITIAL.
    SELECT  *
             FROM bseg
             INTO CORRESPONDING FIELDS OF TABLE chckinit
             FOR ALL ENTRIES IN v_po_det
             WHERE ebeln EQ v_po_det-ebeln AND matnr EQ v_po_det-matnr AND buzid EQ 'W' AND bschl EQ '86' AND koart EQ 'K'.
        SELECT  ebeln
                ebelp
                matnr
                lifnr
                werks
                buzid
                bschl
                bukrs
                belnr
                gjahr
                koart
                augbl
                FROM bseg INTO TABLE chckinit
                  FOR ALL ENTRIES IN v_po_det
                  WHERE ebeln EQ v_po_det-ebeln AND matnr EQ v_po_det-matnr AND buzid EQ 'W' AND bschl EQ '86' AND koart EQ 'K'.
      ENDIF.
      IF chckinit[] IS NOT INITIAL.
    SELECT  *
             FROM payr
             INTO CORRESPONDING FIELDS OF TABLE chckpayer
             FOR ALL ENTRIES IN chckinit
             WHERE vblnr EQ chckinit-augbl.
        SELECT  vblnr
                zbukr
                gjahr
                chect
                zaldt
                hbkid
                FROM payr INTO TABLE chckpayer
                FOR ALL ENTRIES IN chckinit
                WHERE vblnr EQ chckinit-augbl.
      ENDIF.
      SORT chckpayer BY vblnr DESCENDING.
      LOOP AT chckpayer.
        ON CHANGE OF chckpayer-vblnr.
          MOVE   : chckpayer TO chckpayer_u.
          APPEND : chckpayer_u.
          CLEAR  : chckpayer_u, chckpayer.
        ENDON.
      ENDLOOP.
      LOOP AT chckinit.
        MOVE  :  chckinit-ebeln TO chckfinal-ebeln,
                 chckinit-ebelp TO chckfinal-ebelp,
                 chckinit-matnr TO chckfinal-matnr,
                 chckinit-lifnr TO chckfinal-lifnr,
                 chckinit-werks TO chckfinal-werks,
                 chckinit-buzid TO chckfinal-buzid,
                 chckinit-bschl TO chckfinal-bschl,
                 chckinit-bukrs TO chckfinal-bukrs,
                 chckinit-gjahr TO chckfinal-gjahr,
                 chckinit-koart TO chckfinal-koart,
                 chckinit-augbl TO chckfinal-augbl.
        READ TABLE chckpayer_u WITH KEY vblnr = chckinit-augbl gjahr = chckinit-gjahr.
        IF sy-subrc EQ 0.
          MOVE  :  chckpayer_u-vblnr TO chckfinal-vblnr,
                   chckpayer_u-zbukr TO chckfinal-zbukr,
                   chckpayer_u-chect TO chckfinal-chect,
                   chckpayer_u-zaldt TO chckfinal-zaldt,
                   chckpayer_u-hbkid TO chckfinal-hbkid.
          APPEND : chckfinal.
        ENDIF.
        CLEAR : chckfinal, chckpayer_u, chckinit.
      ENDLOOP.
    Populating the final CST TABLE
      LOOP AT v_po_det.
        MOVE  :   v_po_det-lifnr TO cst_rep-lifnr,
                  v_po_det-werks TO cst_rep-werks,
                  v_po_det-ebeln TO cst_rep-ebeln,
                  v_po_det-ebelp TO cst_rep-ebelp,
                  v_po_det-bedat TO cst_rep-bedat,
                  v_po_det-matnr TO cst_rep-matnr,
                  v_po_det-kbetr TO cst_rep-kbetr.
        READ TABLE gr_wh_info WITH KEY ebeln = v_po_det-ebeln ebelp = v_po_det-ebelp."matnr = v_po_det-matnr.
        IF sy-subrc EQ 0.
          MOVE :  gr_wh_info-mblnr TO cst_rep-mblnr,
                  gr_wh_info-bldat TO cst_rep-bldat,
                  gr_wh_info-menge TO cst_rep-menge,
                  gr_wh_info-dmbtr TO cst_rep-dmbtr,
                  gr_wh_info-bwart TO cst_rep-bwart,
                  gr_wh_info-whssn TO cst_rep-whssn,
                  gr_wh_info-whsdt TO cst_rep-whsdt.
        ENDIF.
        READ TABLE vend_inv WITH KEY ebeln = v_po_det-ebeln ebelp = v_po_det-ebelp."matnr = v_po_det-matnr.
        IF sy-subrc EQ 0.
          MOVE : vend_inv-buzid TO cst_rep-buzid,
                 vend_inv-bschl TO cst_rep-bschl,
                 vend_inv-wrbtr TO cst_rep-wrbtr,
                 vend_inv-belnr TO cst_rep-belnr,
                 vend_inv-gjahr TO cst_rep-gjahr,
                 vend_inv-xblnr TO cst_rep-xblnr.
        ENDIF.
        READ TABLE chckfinal WITH KEY ebeln = v_po_det-ebeln ebelp = v_po_det-ebelp."matnr = v_po_det-matnr.
        IF sy-subrc EQ 0.
          MOVE : chckfinal-augbl TO cst_rep-augbl,
                 chckfinal-vblnr TO cst_rep-vblnr,
                 chckfinal-zbukr TO cst_rep-zbukr,
                 chckfinal-chect TO cst_rep-chect,
                 chckfinal-zaldt TO cst_rep-zaldt,
                 chckfinal-hbkid TO cst_rep-hbkid.
        ENDIF.
        READ TABLE mat_desc WITH KEY matnr = v_po_det-matnr.
        IF sy-subrc EQ 0.
          MOVE : mat_desc-maktx TO cst_rep-maktx.
        ENDIF.
        READ TABLE vend_det WITH KEY lifnr = v_po_det-lifnr.
        IF sy-subrc EQ 0.
          MOVE : vend_det-name1 TO cst_rep-name1,
                 vend_det-j_1icstno TO cst_rep-j_1icstno.
        ENDIF.
        APPEND : cst_rep.
        CLEAR  : cst_rep, v_po_det, gr_wh_info, vend_inv, chckfinal.
      ENDLOOP.
    Populating GT_output
      LOOP AT cst_rep.
        cst_gr = cst_rep-dmbtr * ( cst_rep-kbetr / 1000 ).
        cst_inv = cst_rep-wrbtr * ( cst_rep-kbetr / 1000 ).
        MOVE : cst_gr  TO cst_rep-cst_dmbtr,
               cst_inv TO cst_rep-cst_wrbtr.
        MODIFY : cst_rep.
        CLEAR : cst_rep, cst_gr, cst_inv.
      ENDLOOP.
      LOOP AT cst_rep.
        MOVE :  sy-tabix TO gt_output-slno,
                cst_rep-lifnr TO gt_output-lifnr,
                cst_rep-name1 TO gt_output-name1,
                cst_rep-j_1icstno TO gt_output-j_1icstno,
                cst_rep-werks TO gt_output-werks,
                cst_rep-matnr TO gt_output-matnr,
                cst_rep-maktx TO gt_output-maktx,
                cst_rep-ebeln TO gt_output-ebeln,
                cst_rep-ebelp TO gt_output-ebelp,
                cst_rep-bedat TO gt_output-bedat,
                cst_rep-mblnr TO gt_output-mblnr,
                cst_rep-bldat TO gt_output-bldat,
                cst_rep-menge TO gt_output-menge,
                cst_rep-dmbtr TO gt_output-dmbtr,
                cst_rep-cst_dmbtr TO gt_output-cst_dmbtr,
                cst_rep-bwart TO gt_output-bwart,
                cst_rep-whssn TO gt_output-whssn,
                cst_rep-whsdt TO gt_output-whsdt,
                cst_rep-buzid TO gt_output-buzid,
                cst_rep-bschl TO gt_output-bschl,
                cst_rep-wrbtr TO gt_output-wrbtr,
                cst_rep-cst_wrbtr TO gt_output-cst_wrbtr,
                cst_rep-belnr TO gt_output-belnr,
                cst_rep-gjahr TO gt_output-gjahr,
                cst_rep-xblnr TO gt_output-xblnr,
                cst_rep-augbl TO gt_output-augbl,
                cst_rep-vblnr TO gt_output-vblnr,
                cst_rep-zbukr TO gt_output-zbukr,
                cst_rep-chect TO gt_output-chect,
                cst_rep-zaldt TO gt_output-zaldt,
                cst_rep-hbkid TO gt_output-hbkid.
        APPEND gt_output.
        CLEAR : cst_rep, gt_output, sy-tabix.
      ENDLOOP.
    END-OF-SELECTION.
    *-ALV Routine
      PERFORM alv_forms.
    *&      Form  alv_forms
    FORM alv_forms.
      PERFORM alv_routines.
      gx_variant = sy-repid.
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
        EXPORTING
          i_save     = g_save
        CHANGING
          cs_variant = gx_variant
        EXCEPTIONS
          not_found  = 2.
      IF sy-subrc = 0.
        vari = gx_variant-variant.
      ENDIF.
      PERFORM comment_build  USING gt_list_top_of_page[].
      PERFORM fieldcat_init  USING gt_fieldcat[].
      PERFORM layout_build USING gs_layout.
      PERFORM print_build  USING gs_print.
      PERFORM alv_output.
    ENDFORM.                    " alv_forms
    *&      Form  alv_routines
    FORM alv_routines.
      PERFORM eventtab_build USING gt_events[].
      PERFORM e06_t_sort_build  USING gt_sort[].
      PERFORM sp_group_build USING gt_sp_group[].
      g_save = 'A'.
      PERFORM variant_init.
    ENDFORM.                    " alv_routines
    *&      Form  eventtab_build
    ----

    Hi Anu,
    These two statements taking to much time for execution what I can do for reducing execution time.
    Regards,
    Rakesh
    SELECT ebeln
    ebelp
    matnr
    lifnr
    werks
    buzid
    bschl
    wrbtr
    bukrs
    belnr
    gjahr
    FROM bseg INTO TABLE bseg_itab
    FOR ALL ENTRIES IN v_po_det
    WHERE ebeln EQ v_po_det-ebeln AND matnr EQ v_po_det-matnr AND buzid EQ 'W' AND bschl EQ '96'.
    ENDIF.
    SELECT ebeln
    ebelp
    matnr
    lifnr
    werks
    buzid
    bschl
    bukrs
    belnr
    gjahr
    koart
    augbl
    FROM bseg INTO TABLE chckinit
    FOR ALL ENTRIES IN v_po_det
    WHERE ebeln EQ v_po_det-ebeln AND matnr EQ v_po_det-matnr AND buzid EQ 'W' AND bschl EQ '86' AND koart EQ 'K'.
    ENDIF.

  • JS CS3: Help to reduce running time of my script

    Hi
    We have developed a script to find similiar words/characters at the end/start of 3 or more continous lines. The script has been developed by following steps:
    1. Get all lines of the document;
    2. Get first 2 characters of first line and compare with next two lines' first 2 characters.
    3. If matches, then give a no break before the word to flow.
    The same procedure for find end characters of the lines.
    As our documents has more than 300 pages, the script runs too long time (about 15 minutes) per document.
    Could any suggest to reduce the time of script running?
    My basic sript is:
    for (k=0; k<myStory.paragraphs.item(i).lines.length; k++) {
    var myParaText =  myStory.paragraphs.item(i);
    var myChar2Fa = myParaText.lines[k].characters.itemByRange(0,1).texts[0].contents;
    var myChar2Fb = myParaText.lines[k+1].characters.itemByRange(0,1).texts[0].contents;
    var myChar2Fc = myParaText.lines[k+2].characters.itemByRange(0,1).texts[0].contents;
    if (myChar2Fa== myChar2Fb && myChar2Fa== myChar2Fc) {
        myParaText.lines[k+2].characters[-1].noBreak=true;
    Kindly suggest.
    regards
    Masthan

    Every interaction with the Object model costs -- in this case, asking ID for paragraphs.item(i).line, itemByrange(), etc. Avoid this by storing as much as possible direct references into variables.
    Every interaction with the document text itself also costs -- you will see the script runs much faster if you only count the number of occurrences. (But this cannot be avoided.)
    That said, your way of retrieving the first 2 characters per line is rather clumsy ... My version still takes the odd minute or so, for a 300 page test document, but I think it's mainly because ID has to re-flow each paragraph it changes.
    myStory = app.selection[0].parentStory;
    ln = myStory.lines;
    n_ln = ln.length;
    for (i=0; i<n_ln-2; i++)
    if (ln[i].length > 1 &&
      ln[i].contents.substring(0,2) == ln[i+1].contents.substring(0,2) &&
      ln[i].contents.substring(0,2) == ln[i+2].contents.substring(0,2))
      ln[i+2].characters[-1].noBreak=true;
    I'm not convinced this does what you intend: avoiding three consecutive lines to start with the same two characters. First of all, to be sure you'd need to run it again, since reflowing the text may move another word to the front of the line with those same characters.
    Second: the [-1] is a special index in InDesign. It does not point to the item before the current (as it would if -1 was treated the same as 0, 1, and 100), but instead it counts backwards from the end of the indexed item -- in this case, the No Break is applied to the last character of the 3rd line. I bet you wanted to apply it to the last character of the 2nd line (which, if so, is easy fixed).

  • Web report for opening it takes long time how to reduce the time?

    HI Experts,
    I created report using webi. For next time while opening it takes more time. How to reduce the time.

    Hi Manikandan,
    There could be multiple reason behind the bad performance.
    1. Are you using supported JVM version to run Webi reports?
    2. Do the reports contain prompts? Are the LOVs set to "Automatic refresh before use"? If yes, uncheck it.
    3. How many queries do the report has? Can you run the queries one by one and check which query is taking much time?
    4. If it based on relational database, copy and run it against the database directly and check how much time it takes. If more, you may have to fix the issue at database level like using temporary tables, indices, etc.
    5. Also check if there are firewalls or proxy server between client and server communication. if yes, try to refresh the report directly on BO server and check.
    6. Check if there is any hinderance between BO server and Database server communcation.
    Hope it will help.
    Regards,
    Yuvraj

  • Slow calc time with SET CREATEBLOCKONEQ OFF for block creation

    Hello everyone,
    I have a problem with the slow execution of one of my calc scripts:
    A simplified version of my calc script to calculate 6 accounts looks like this:
    SET UPDATECALC OFF;
    SET FRMLBOTTOMUP ON;
    SET CREATEBLOCKONEQ ON;
    SET CREATENONMISSINGBLK ON;
    FIX (
    FY12,
    "Forecast",
    "Final",
    @LEVMBRS("Cost Centre",0),
    @LEVMBRS("Products",0),
    @LEVMBRS("Entities",0)
    SET CREATEBLOCKONEQ OFF;
    "10000";"20000";"30000";"40000";"50000";"60000";
    SET CREATEBLOCKONEQ ON;
    ENDFIX
    The member formula for each of the accounts is realtively complex. One of the changes recently implemented for the FIX was openin up the cost center dimension. Since then the calculation runs much slower (>1h). If I change the setting to SET CREATEBLOCKONEQ ON, the calculation is very fast (1 min). However, no blocks are created. I am looking for a way to create the required blocks, calculate the member formulas but to decrease calc time. Does anybody have any idea what to improve?
    Thanks for your input
    p.s. DataStorage in the member properties for the above accounts is Never Share

    MattRollings wrote:
    If the formula is too complex it tends not to aggregate properly, especially when using ratios in calculations. Using stored members with member formulas I have found is much faster, efficient, and less prone to agg issues - especially in Workforce type apps.We were experiencing that exact problem, hence stored members^^^So why not break it up into steps? Step 1, force the calculation of the lower level member formulas, whatever they are. Make sure that that works. Then take the upper level members (whatever they are) and make them dynamic. There's nothing that says that you must make them all stored. I try, wherever possible, to make as much dynamic as possible. As I wrote, sometimes I can't for calc order reasons, but as soon as I get past that I let the "free" dense dynamic calcs happen wherever I can. Yes, the number of blocks touched is the same (maybe), but it is still worth a shot.
    Also, you mentioned in your original post that the introduction of the FIX slowed things down. That seems counter-intuitive from a block count perspective. Does your FIX really select all level zero members in all dimensions?
    Last thought on this somewhat overactive thread (you are getting a lot of advice, who knows, maybe some of it is good ;) ) -- have you tried flipping the member calcs on their heads, i.e., take what is an Accounts calc and make it a Forecast calc with cross-dims to match? You would have different, but maybe more managable block creation issues at that point.
    Regards,
    Cameron Lackpour

  • Want to modify procedure to reduce execution time.

    Hi,
    I am using oracle 10g.I had written a procedure which returns me list of telephone nos selected based on selection criteria.My procedure is working but its taking time.I am using a query which returns me list of rows.The count of row is very much.so each time it execute the query in loop, and it takes time.I want to use cursor so that at one time it will be executed and those records will be checked instead of executing the query everytime....
    The query which is used is :
    select * from abc;
    Please take this in cursor if possible...i had used it in my procedure below in for loop....I will be thankful to you in this regard.
    The procedure is below:
    create or replace PROCEDURE "OM_GET_SELECTED_TEL" (
    ni_array IN ty_npa_id,
    reqquantity IN NUMBER,
    availableinvids OUT ty_tel_no
    AS
    begin
    declare
    available ty_tel_no:= ty_tel_no();
    output VARCHAR2 (400);
    k number(3):= 1;
    BEGIN
    DBMS_OUTPUT.put_line ('tnType IS G');
    FOR i IN 1 .. ni_array.COUNT
    LOOP
    FOR j IN
    (SELECT tel_no,
    CASE
    WHEN REGEXP_LIKE (tel_no, '(\d)\1\1\1$')
    THEN 'condition 1 fullfilled'
    WHEN REGEXP_LIKE (tel_no, '(\d)\1(\d)\2$')
    THEN 'condition 2 fullfilled'
    WHEN REGEXP_LIKE (tel_no,
    '\d(\d)\1\1$|(\d)\2\2\d$'
    THEN 'condition 3 fullfilled'
    ELSE 'condition 4 fullfilled'
    END condition
    FROM (select * from abc) order by condition)
    LOOP
    output := j.condition;
    available.extend();
    IF (output = 'condition 1 fullfilled')
    THEN
    available(k) := j.tel_no;
    k := k+1;
    --availableinvids (i) := j.tel_no;
    DBMS_OUTPUT.put_line ('selected nos which satisfy condition 1:' || j.tel_no);
    ELSIF (output = 'condition 2 fullfilled')
    THEN
    available(k) := j.tel_no;
    k := k+1;
    --availableinvids (i) := j.tel_no;
    DBMS_OUTPUT.put_line ('selected nos which satisfy condition 2:' || j.tel_no);
    ELSIF (output = 'condition 3 fullfilled')
    THEN
    available(k) := j.tel_no;
    k := k+1;
    --availableinvids (i) := j.tel_no;
    DBMS_OUTPUT.put_line ('selected nos which satisfy condition 3:' || j.tel_no);
    ELSE
    available(k) := j.tel_no;
    k := k+1;
    DBMS_OUTPUT.put_line ('selected nos which dont satisfy condition :' || j.tel_no);
    END IF;
    EXIT WHEN k = reqquantity + 1 ;
    END LOOP;
    EXIT WHEN k = reqquantity + 1 ;
    END LOOP;
    end;
    END;

    kordirko thanks for your reply...but i didnt got your point.I need a stored procedure not a function also i had two cases and my query (select * from abc ) is a big query i had just written a sample query...it returns me a lot of tel nos. based on conditions in query....I am writing my complete procedure below.Please if possible give a alternate solution to reduce the time of query...if u want u may use cursor also...a function is also ok, if it returns what my procedure returns.U may see the query in both cases are same. So better take the query out of it....so that it may execute 1 time only, not mulitple times....Also ni_array is array which is passed to procedure.reqquantity is number of tel nos wanted in output...tntype is either S or G....and availableinvids gives me the ouput.....I will be thankful to you in this regard.
    My full procedure is below:
    create or replace PROCEDURE "OM_GET_SELECTED_TEL" (
    ni_array IN ty_npa_id,
    reqquantity IN NUMBER,
    tntype IN VARCHAR2,
    availableinvids OUT ty_tel_no
    AS
    begin
    declare
    available ty_tel_no:= ty_tel_no();
    output VARCHAR2 (400);
    k number(3):= 1;
    BEGIN
    IF tntype = 'G'
    THEN
    DBMS_OUTPUT.put_line ('tnType IS G');
    FOR i IN 1 .. ni_array.COUNT
    LOOP
    FOR j IN
    (SELECT tel_no,
    CASE
    WHEN REGEXP_LIKE (tel_no, '(\d)\1\1\1$')
    THEN 'condition 1 fullfilled'
    WHEN REGEXP_LIKE (tel_no, '(\d)\1(\d)\2$')
    THEN 'condition 2 fullfilled'
    WHEN REGEXP_LIKE (tel_no,
    '\d(\d)\1\1$|(\d)\2\2\d$'
    THEN 'condition 3 fullfilled'
    ELSE 'condition 4 fullfilled'
    END condition
    FROM (select * from abc) order by condition)
    LOOP
    output := j.condition;
    available.extend();
    IF (output = 'condition 1 fullfilled')
    THEN
    available(k) := j.tel_no;
    k := k+1;
    --availableinvids (i) := j.tel_no;
    DBMS_OUTPUT.put_line ('selected nos which satisfy condition 1:' || j.tel_no);
    ELSIF (output = 'condition 2 fullfilled')
    THEN
    available(k) := j.tel_no;
    k := k+1;
    --availableinvids (i) := j.tel_no;
    DBMS_OUTPUT.put_line ('selected nos which satisfy condition 2:' || j.tel_no);
    ELSIF (output = 'condition 3 fullfilled')
    THEN
    available(k) := j.tel_no;
    k := k+1;
    --availableinvids (i) := j.tel_no;
    DBMS_OUTPUT.put_line ('selected nos which satisfy condition 3:' || j.tel_no);
    ELSE
    available(k) := j.tel_no;
    k := k+1;
    DBMS_OUTPUT.put_line ('selected nos which dont satisfy condition :' || j.tel_no);
    END IF;
    EXIT WHEN k = reqquantity + 1 ;
    END LOOP;
    EXIT WHEN k = reqquantity + 1 ;
    END LOOP;
    ELSIF tntype = 'S'
    THEN
    DBMS_OUTPUT.put_line ('tnType IS S');
    FOR i IN 1 .. ni_array.COUNT
    LOOP
    FOR j IN
    WITH     got_grp_id AS
         SELECT     tel_no
         ,     REGEXP_REPLACE ( tel_no
                   , '-\d+$'
                   )     AS nos_part_1
         ,     TO_NUMBER ( REGEXP_SUBSTR ( tel_no
                             , '\d+$'
                   ) - ROW_NUMBER () OVER ( PARTITION BY REGEXP_REPLACE ( tel_no
                                                      , '-\d+$'
                                  ORDER BY     tel_no
                                  ) AS grp_id
         FROM (select * from abc
    ,     got_grp_cnt     AS
    SELECT     got_grp_id.*
    ,     COUNT (1) OVER ( PARTITION BY nos_part_1
    ,     grp_id
    ) AS grp_cnt
    FROM     got_grp_id
    ORDER BY grp_cnt     DESC
    ,      tel_no
    SELECT     tel_no
    FROM     got_grp_cnt
    WHERE     ROWNUM     <= reqquantity
    LOOP
    output := j.tel_no;
    DBMS_OUTPUT.put_line ('reqquantity:'||reqquantity) ;
    available.extend();
    available(k) := output;
    k := k+1;
    DBMS_OUTPUT.put_line ('selected nos for S type are:' || j.tel_no) ;
    END LOOP;
    END LOOP;
    ELSE
    DBMS_OUTPUT.put_line ('WRONG TNTYPE');
    END IF;
    end;
    END;

  • To reduce execution time of a Business Objects Dataservices job.

    The  issue that we are facing-
    Our goal-  To compare a record from a file  with 422928 records from another table on basis of  name & country, if a match is found then you take some specific columns of that matched record (from the table ) as our ouput.
    What we are doing-  We are at 1st  removing duplicates by doing matching on the address components (i.e.- addr_line1, city, state, postal code & country), here                    the break key for match transform is country & postal_code, its taking 1823.98 secs. Now the record count is 193317
                      Then we are merging the file record along with the 193317 records to put them in the same path and send them for matching.
                      The match criteria is the firm name & iso_country_cd,
                       the break key for match transform is the  iso_country_cd & the 1st  letter  of the name.
                       It took 1155.156 secs.
    We have used the "Run match as seperate process' option for the match to reduce the time.
    The whole job took  3038.805 secs.
    Please suggest how to reduce the execution time.
    Edited by: Susmit Das on Mar 29, 2010 7:41 AM

    This really is impossible to help with without seeing your code.
    Replacing while loops with Timed Loops will not help. Timed Loops are used for slowing while loops down in a controlled manner. You would use them to synchronise with a clock rate, and can set other parameters for priority and CPU allocation etc. These will not likely help to reduce your execution time.
    If you are seeing code execution of 1 second then you will need to optimise your code to reduce the execution time. There are LabVIEW guides on how to improve your code execution time, just search around for them.
    Also try using the Profiling tools to learn which VIs (I presume your code is componentised and each while loop contains subVIs?) are hogging the most CPU time.
    If you cannot share your VI then there it is very hard to know where your code execution bottlenecks are.
    Thoric (CLA, CLED, CTD and LabVIEW Champion)

  • Reduce execution time

    How to reduce the execution time of this code? 
    Loop at porder1.
    SELECT aufnr bstmg hsdat sgtxt bwart charg FROM mseg INTO
    (porder-aufnr,porder-bstmg,porder-hsdat,porder-sgtxt,porder-bwart,
    porder-charg)
                                             WHERE matnr = porder1-matnr AND
                                                   aufnr = porder1-aufnr AND
                                                   werks = porder1-pwerk AND
                                                   ( bwart = '101' OR
                                                     bwart = '102' ).
    Endselect.
    Endloop.
    Regards
    Praju .

    Hi prajwal.
    I would like to suggest,
    It is possible to reduce the time of execution by Increasing the number of fields in the WHERE clause as only those specific number of records are fetched which results in comparatively less execution time.
    Also, SAP has designed such powerfull tools like Transactions - ST05,  ST07, ST30, and many more
    I would like to suggest you a couple of references relating to your case,
    [SDN - Reference for Long execution time during processing of a select query|/thread/477540 [original link is broken];
    [SDN - Reference for Reducing the Execution time of the program - Tools|How can i reduce time of execution;
    [SDN - Reference for solutions to reduce the execution time of a program|How to reduce my query execution time?;
    Hope that's usefull.
    Good Luck & Regards.
    Harsh Dave

  • Reduce publishing time for Air iOS apps?

    Hi,
    Currently it's taking my machine up to  4 minutes to publish an Air iOS app.
    Are there any settings or hacks I could try to reduce the time?
    I'm using Flash CS 6 + AIR SDK 16 on a Windows 8.1 laptop.
    Stats:
    - Intel Pentium Prozessor (1,5 GHz, Intel HD Graphics, Microsoft Windows 8, 64-bit)
    - 4 GB DDR3-RAM
    - 500 GB Hybrid-SSHD-Festplatte with 8 GB SSD
    Thanks for any tips.

    Hi,
    I'm really interested in this feature as well. Have spent a bit of time attempting to get one running through a native extension but it doesn't appear to work. I believe something in the AIR build process is blocking the components required. I've tried several methods so far:
    packaging the appex with an ANE
    packaging the appex with the AIR container app
    using a class instead of a storyboard
    But nothing seems to be working. This is even before the app extension is doing anything. My guess is that the plist file specifying the app extension isn't correctly being included in the application but I have no idea how to update it to test.

  • How to reduce the time for each clips up to 0,04 seconds?

    Hi, I'm trying to realize my first time laps. I've need to reduce the time for each clips up to 0,04 seconds, but it seems that the minimum time is 0,1 second. There's a solution?

    And use a zip file.  Many people can't open RARs.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

Maybe you are looking for