Schedule sequence heuristic

We are currently on scm 5.1 version. planned orders are generated for a together for multiple sale orders by variable heuristic. start dates will be based on the requirement date of sale order.
suddenly the priority changes. the first priority sale order becomed 2nd priority and the second priority becomes first priority. So what we did is, in the priority field, we changed the priority accordingly. then indetailed scheduling planing board, we ran schedule sequence heuristic with earliest date selected order priority in schedule sequence tab withis the heuristic. immedietly the planned order start dates will change. this is ok. But the planned order pegged for the header planned order down the line does not change accordingly, which does not make any sense. actually we have aroung 8 levels of bom wich 4-5 in house products in each level. We cannot go to the product view of each level and each product and change the priority. if the header planned order priority is changed then all the planned orders pegged to it should change. Pls let us know if there is any solution for this.
Thanks
Vinay

Vinay,
If all you want to do is change the priorities of the subordinate orders to match your new priorities at the higher level, then run the Order Priority heuristic (standard is SAP_PP_012).  Also, you could use the top-down scheduling heuristic.  Standard is SAP_PP_010.  These are PP heuristics, so if you are also doing capacity planning, you should review your cap plan to be  sure it is still realistic.
More info at http://help.sap.com/saphelp_scm50/helpdata/en/2e/c0703713bf277ee10000009b38f8cf/frameset.htm
Also, look at the blue 'I" next to the algorithm in /SAPAPO/CDPSC11.
Rgds,
DB49

Similar Messages

  • Use of manual sequencing heuristic with consideration of Fixed pegging.

    Hi,
    I have scheduled the FG and SFG order through optimization for 3 days.To correct the sequence i am using manual sequencing heuristic i.e. SAP003. in the setting i am taking option consider fixed pegging always,scheduling mode as insert operation and scheduling submode as schedule dependent operation according to scheduling mode....But problem i am facing after running this heuristic as some FG orders are getting scheduled before SFG orders and one more problem is orders are crossing the scheduling horizon i.e. 3 days horizon......
    Kindly give some input to resolve the issue.
    Regards
    Pradeepta

    Run Fixed peggeing heurstics before running rescheduling heuristic?
    Vipul

  • Sequencing of orders after PPDS optimization run

    Dear PPDS experts,
    Lets say,after optimization run,we have the following planned orders in the following sequence:
    SIZE   GRADE
      28        B
      28        A
      28        C
      30        C
      30        B
      30        A
    PROBLEM STATEMENT :
    Gradewise sequencing of orders within the same size to be done with priority as A=>B=>C.
    REQUIRED RESULT :
    SIZE   GRADE
      28        A
      28        B
      28        C
      30        A
      30        B
      30        C
    How do we go about this ?

    Hi,
    If you are using CDP(charcteristic dependent planning in APO) with class 400 then you can use following badi
    /SAPAPO/CDPS_ORDDATA metod GET_ORDDATA.
    You need fill the structure CI_ORDCUS e with charcteristic grade and size and use above badi to write logic to read these details from the order.
    above process will make charcteristic available as sequencing parameter in scheduling strategy and schedule sequence heuristic. So there you can choose required order ascending /descending as required.
    I am not sure whether method also works if you use VC in APO side also. You can give a try.
    Second option to use genrati and on of set up matrix based on charcteristics.  Here you can have set up group and setup matrix based on charcteristic values.
    Regards,
    Santosh

  • Heuristic selection

    Dear Gurus,
    We need a heuristic which should do the following:
    a. Finite backwards scheduling
    b. Take setup time into consideration (setup matrix)
    c. Order priority
    The closest heuristic I got was Schedule Sequence (SAP001) with algorithm /SAPAPO/HEUR_PLAN_SEQUENCE. However this performs a current date scheduling.
       Does SAP have any other heuristic which meets the above mentioned criteria? I have searched a lot but couldn't get one.
    Thanks in advance!
    Snigdho

    Hi Snigdho
    You can use reschedule function using scheduling strategy settings as per your requirement to achive finite backward scheduling.  It will consider set up time from set up matrix but it will not optimize set up time.
    Second option is you can use SAP_DS_02 enhanced multilevel backward scheduling heuristic.
    but above heuristic will not consider priorty ans it also schedules orders in past.
    One more option is you can use BADI /sapapo/if_ex_rrp_heur_do to consider user defined scheduling strategy during  heuristic run in background. Here you can use heuristic SAP001 with user defined strategy so that it ignores in built strategy settings in heuristic.
    Regards,
    Santosh

  • Sequencing messages in BPM

    Hi All,
    I have a requirment where i have to send messages sequntially to target.From source i would be receiving 5(say s1,s2,s3,s4,s5) messages.These messages have to be sequntialy sent to target 1,2,3,4,5 in order.
    At one instance i would receive only 1 message.Say 1st i received s2 then i shouldnt send it to target,i should wait for s1 to occur.Next instance s1 occured i should send s1 first then s2.This should be my order.
    Irrespetive of what source and target systems are i would like to know how this kind of sequencing could be implimented in BPM.
    I have implimented "BpmPatternSerializeMultipleTrigger" from BASIS but its not sequncing.
    Its erroring in BPM send step.When s2 is occuring,its not waiting for s1 to occur.Even when next instance is s1.
    Thanks

    HI,
    You can use EOIO, but as processing with BPM uses the same queue. You need to control this sequence on sender side.
    IDOC SCHEDULING
    Sequence files to be execute for XIP
    These messages are using the same BPE queue,
    please apply note 1040354 BPE-TS: Unprocessed messages. Pay
    particular attention also to the guidelines regarding buffering.
    thanks
    Swarup
    Edited by: Swarup Sawant on May 29, 2008 10:59 AM

  • SNP Heuristic recreation and adding of Purchase requisition

    Dear All
    Thanking In advance,
    Critical Issue
    We have scheduled a heuristic run for 7 FERT materials,
    Run was successful in simulation version, When we take a re-run
    (heuristic) on the same data,It is adding the quantities of the
    forecast to the same purchase requisition for only two FERTS, for
    others it is deleting and recreating purchase requisition same as the
    forecast requirement. This in turn is leading to doubling of
    requirement for these two FERTS at the lower BOM materials.
    e.g.If demand is 10 and we run heuristic in first run it will create 10
    purchase requisitions, if we Re-run heuristic on the same data it is
    adding 10 more quantity for same purchase requisition.
    Before generating the requisitios it will show the message Invalid order and help of which shows "Order does not exist in Live-Cache"
    What could be the reason for this?
    Amol

    Dear all,
    problem solved by upgarding Support Pack to 15.0
    Amol
    Edited by: Amol Chavan on Jan 21, 2008 4:08 PM

  • Lead time scheduling Vs Takt time scheduling

    Hi Experts, we are planning to implement sap in one of our plants..below is our business structure for your understanding..
    OEM - Mini bus Manufacturer which is the customer
    Bus seat manufacturer - Our plant (we already have sap here) - we already have sap repetitive here
    bus seat components manufacture - our plant (we are planning implement sap here)
    based on bus seat forecast the component plant will drive their production and will be send it to assembly plant which is seat manufacture.
    I have two questions
    1. what should we do in our component plant discrete orders or repetitive? I know you cannot tell me without seeing the plant but that my question. what questions should be ask our business to make this decision? how do anyone make the decision of going either repetitive or discrete? pleade do not point out the link to rep vs dis.. I have already those but I need something more in detail..
    2. I was reading a lot of help.sap.com and I have a question on below statement
    Basically, you can use two different types of scheduling:
    Sequencing with takt-based/rate-based scheduling
    The system schedules the planned orders using the number of takts and the takt times/rates of the line hierarchy. You define the line hierarchy in Line Design. In this type of scheduling, the system does not create any capacity requirements and only schedules the main lines. The system does not schedule the feeder lines.
    Lead time scheduling
    In lead time scheduling, the system creates capacity requirements and also schedules the feeder lines. The system uses the operations from the rate routing or the standard routing for lead time scheduling.
    what does lead time schuling will also do feeder line scheduling and take based does not schedule feeder lines means? can some explain with an example?
    Thx
    Swathi

    any help is appreciated

  • Using the PPDS setup matrix

    Hello All -
    I have 3 products A,B and C which  are run on a single line during a particular week(day). We have certain set-up times when we move from one product to another. Here are the set-up times:
    The sequence in which these products run on the line is decided by the plant scheduler during production planning. The production planners run heuristics and peform manual changes to the planned orders. They know which product runs in which shift but they do not necessarily adjust the planned orders to the hourly level.
    What we would like the system to do is somehow incorporate the set-up times when we move from one product to another.  We would like to see the the resource being consumed during the set-up time.
    Also, we are not in a position to use the optimizer. So any solutions involving the Optimizer are out of scope. Just want to achieve this using heuristics.
    To achieve this, I have created the following master data:
    1) Created 3 setup groups SG1(A), SG2(B), SG3(C).
    2) Created a setup matrix SM1 and set up the transitions for   all the above combinations.
    3) Assign the setup group to operations in a ppm
    4) Assign the setup matrix to the resource
    I then created 3 planned orders in production planning for the SAME day. All 3 have the same availability time 23:59:59 and based on run-rates we have different start times.
    I have the following questions:
    1) Which DS heuristic should I use to adjust the start times and the end times of these orders by considering the set-up times in the setup matrix?
    The resource should basically be consumed during these setup times. I have looked at "Reschedule" function in the DS planning board but I get an error when I run this. Please see end of this post for the error. The message says I may not have free capacity, but I do. I am using backward scheduling and infinite.
    2) Is there anyway the set-up times/matrix can be considered during production planning itself and not during detailed scheduling?
    3) Can the option of "Schedule Sequence" work for my scenario.
    Appreciate all your help.
    Varun
    Error during scheduling
    Message no. /SAPAPO/OM043
    Diagnosis
    The system could not schedule an order, operation or activity.
    This could have the following causes:
    The resource does not have any free working time or capacity.
    If you have set planning direction backwards in the strategy profile:
    There is not enough working time or capacity available for scheduling between now and the scheduling date.
    If you have set planning direction forwards in the strategy profile:
    There is not enough working time or capacity available for scheduling between the scheduling date and the end of the planning area.
    If you plan characteristics-dependently:
    You have assigned characteristics to operations of the order that do not agree with characteristics of the resources on which the operations are to be processed.
    The system cannot find any suitable characteristics on the resources and so it cannot schedule.
    Procedure
    Depending on which of the above reasons is the cause, change the following settings:
    Change the working times and capacities of the resources.
    Set the planning mode "infinite planning" in the strategy profile.
    Activate the planning direction forwards or backwards and reverse in the strategy profile.
    Change the characteristics that you have assigned to the resource.

    Thank you all -
    It was a mistake on my part. I was supposed to create a new "set up" activity before processing activity and make that relevant to set-up. I had the processing step checked for setp all this while. Now its working.
    Thanks
    Varun

  • Add fields to Algorithm /SAPAPO/HEUR_PLAN_SEQUENCE_MAN

    Dear Colleagues,
    Under certain circumstances Production Scheduler need to sequence some operations manually so we are using Heuristic SAP003 "Schedule Sequence Manually".
    In order to achieve this, it would be very useful (and with real added value to the scheduler task) to have some extra field in the "List of operations" when using the algorithm /SAPAPO/HEUR_PLAN_SEQUENCE_MAN
    The field we need to add are stored at Planned Order/Production order level and are relevant for all operations in it. The fields are specific characteristics:
    The question: Is there a non ABAP way we can ask the system to add the required fields in to the layout of the "Sequence to be planned" list, so the Production Scheduler can take better decisions?
    Thanks in advance.
    Best regards,
    Rubén P.
    Message was edited by: Rubén Partido

    Hi Ruben,
    You could create a Visualization Profile in SPRO - SCM - PPDS - Product Planning Table - Define Visualization Profile.
    The characteristics will be available in the selection fields of heuristic Sequence Schedule. So, the planner will be able to perform a automatic sequence characteristics based.
    Unfortunately for manually this solution is not possible.
    Below you have the explanation of the profile (from SAP Help).
    Thanks, Marius   
    Define Visualization Profiles
    In this IMG activity, you can define the visualization
    profiles for the display of the characteristics
    in the sequence schedule, in the product planning table, in
    the product view and in planned order management. You can also
    define visualization profiles for the display of restrictions
    in the sequence schedule or in the restriction hit view of the
    product planning table to limit the number of restrictions displayed.
    Example
    For example, you can define a profile for the 10 most important
    characteristics and specify a colored background for these characteristics.
    These characteristics are then displayed in the permitted applications. In the
    sequence schedule, these characteristics are then displayed in additional
    columns in the scheduled orders section, for example.
    Activities
    1. First, enter a description of the profile undeVisualization Profile
    2. Then under Characteritics/Restrictions enter up to 10 characteristics or restrictions. You can define the column number in which the characteritic is to be displayed in the applications and a color for the background.
    3. Under Application define whether the profile is only to be used for a certain application or whether it is to apply to all applications.
    4. If you only want to use the visualization profile for one particular line or one particular line network, then define the iPPE nodes of the line or the line network as well as the application.
    Further notes
    You can also create visualization profiles directly in the sequence
    schedule:
    If you want to define a visualization profile for restrictions, you
    can do so in the restrictions chart by accessing the function
    Create Visualization Profile via a function key.
    If you want to create a visualization profile for characteristics,
    choose Edit --> Create Profile for Characteristics from the menu. In
    this case, the system determines the 10 most frequent characteristics among the
    scheduled orders and automatically creates a visualization profile for these
    characteristics.
    If you choose
    Edit --> Create Profile for Characteristic -
    Online
    , the system determines the 10  most frequently occurring
    characteristics and provides them for selection. You can then select the
    characteristics you require and then choose the
    Create Profile
    function
    key. The system then creates a visualization profile for all the characteristics
    you selected.
    If you also want to use a profile that was created automatically in other
    applications, such as in the product planning table, you have to make the
    necessary setting adjustments manually in Customizing.

  • DS board profiles

    1. In DS Board --  we have DS strategy profile as SAP001 and PP strategy profile as SAP002 and we are running Heuristics like -- schedule sequence, remove backlog etc . These Heuristics have their own strategy settings related to scheduling mode and planning direction- how DS strategy profile or PP strategy profile influences the production planning and scheduling here ?
    (a)Taking an example --In PP strategy profile(SAP002), the scheduling mode is -- 'infinite scheduling' while in case of DS strategy profile it is 'find slot'.Heuristic 'remove backlog' has scheduling mode as 'insert operation'. If I run heuristic 'remove backlog' in DS board then what scheduling mode will be chosen by system out of 3 -- Find slot, infinite and insert ?
    (b)In case planning directions are different between PP strategy profile, DS strategy profile and the Heuristic being run --then which planning direction will be chosen ?
    Thanks in advance for help.

    Hi Learner,
    The DS strategy is used for the following actions: Reschedule, deallocate, interrupt operation, fix, cancel fix, and reschedule using drag and drop.
    The PP strategy is used for the following (order processing) functions: create order, create based on templateedit, change quantity and change source of supply.
    For DS functions such as scheduling or rescheduling, for example, the system uses the DS strategy profile whereas it uses the PP strategy profile for PP functions such as creating an order or changing an order quantity.
    Please refer consulting note 663297 - Strategy settings for planning (documentation)
    Regards,
    R.Brahmankar

  • How to run mrp and capacity leveling through heuritics.

    Hi,
    How to run mrp and capacity leveling through heuritics.
    What are the setps required for production planning run this thing in the heuritics in pp/ds?
    Regards,
    Sunil

    Sunil,
    APO PP/DS doesn't have a 1-to-1 match for MRP/Cap levelling per se.  There are, though, a limitless number of ways to achieve the results you want.
    Start with a basic PP planning MRP - SAP_PP_002, which will should create all necessary planned orders
    Then try a DS heuristic to schedule your orders according to capacity.  Schedule Sequence SAP001 is a good starting point.  This can be used to schedule your cap relevant work centers such that they fully load the capacity available, similar to cap levelling.
    Rgds,
    DB49

  • Algorithms in APO

    Hello,
    Please let me know what are all the Algorithms used in APO - DP, PPDS & SNP.
    Even If i get the Name of the Algorithm, its better.
    Thansk & Regards.

    Hi,
    In APO algorthims are Heuristics
    Folloeing Heuristics are available
    Short Description     Heuristic
    Schedule Sequence     SAP001
    Remove Backlog     SAP002
    Schedule Sequence Manually     SAP003
    Minimize Runtime     SAP004
    Schedule Operations     SAP005
    Reschedule Blocks     SAP_CDPBP_01
    Adjust and Reschedule Block Limits     SAP_CDPBP_02
    Enhanced Block Maintenance     SAP_CDPBP_03
    Block Maintenance, Called Interactively     SAP_CDPBP_04
    Admissibility OK Without Check     SAP_CDS_A01
    Tolerance Check     SAP_CDS_A02
    Confirm Compliance Without Check     SAP_CDS_F01
    Days' Supply Check     SAP_CDS_F02
    Product Heuristic w. Days' Supply Check     SAP_CDS_F03
    Check PDS     SAP_CHECK_01
    Stable Forward Scheduling     SAP_DS_01
    Enhanced Backward Scheduling     SAP_DS_02
    Change Fixing/Planning Intervals     SAP_DS_03
    Activate Seq.-Dependent Setup Activities     SAP_DS_04
    Length-Based Heuristic     SAP_LEN_001
    Manual Creation of LOP Order     SAP_LEN_002
    Multi-Level, Order-Related - Bottum-Up     SAP_MLO_BU
    Multi-Level, Order-Related - Top-down     SAP_MLO_TD
    Model Mix Planning Run 1     SAP_MMP_HFW1
    Multiple Output Planning Heuristic     SAP_MOP_001
    Manual Creation of MOP Order     SAP_MOP_002
    Product Planning (Comp. acc. LLevl Code)     SAP_MRP_001
    Product Planning (Plan Comp. Immdiately)     SAP_MRP_002
    Create Production Campaigns     SAP_PCM_CRT
    Dissolve Production Campaigns     SAP_PCM_DIS
    Delete Setup/Clean-Out Orders     SAP_PCM_ODEL
    Create Setup/Clean-Out Orders     SAP_PCM_SRVA
    Merge Orders (Container Resources)     SAP_PI_001
    Critical Path     SAP_PMAN_001
    Infinite Forward Scheduling     SAP_PMAN_002
    Infinite Backward Scheduling     SAP_PMAN_003
    Change Order Manually     SAP_PP_001
    Planning of Standard Lots     SAP_PP_002
    Planning of Shortage Quantities     SAP_PP_003
    Planning of Standard Lots in 3 Horizons     SAP_PP_004
    Part Period Balancing     SAP_PP_005
    Least-Unit Cost Proc.: Ext. Procurement     SAP_PP_006
    Reorder Point Planning     SAP_PP_007
    Rescheduling: Bottom-Up for Conti- I/O     SAP_PP_008
    Rescheduling: Bottom Up     SAP_PP_009
    Rescheduling: Top Down     SAP_PP_010
    Delete Fixed Pegging Relationships     SAP_PP_011
    Change Order Priorities     SAP_PP_012
    Groff Procedure     SAP_PP_013
    Ascertaining Pl.Ind.Requirements     SAP_PP_014
    Adjusting Orders and Pl.Ind.Requirements     SAP_PP_015
    Adjusting Special Orders     SAP_PP_016
    Plan Standard Lots for Co-Products     SAP_PP_017
    Create Safety Stock in SAP liveCache     SAP_PP_018
    Fix Pegging Relationships     SAP_PP_019
    Stage-Numbering Algorithm     SAP_PP_020
    New Explosion     SAP_PP_021
    Planning of Standard Lots for Conti- I/O     SAP_PP_C001
    Capacity-Driven Order Creation     SAP_PP_CDOC
    Planning Shortage Quantities for CTP     SAP_PP_CTP
    Heuristic for Supersession Chains     SAP_PP_I001
    Quota Heuristics     SAP_PP_Q001
    Planning of Std Lots with Shelf Life     SAP_PP_SL001
    Restore Requests f.Contract Release Ords     SAP_PP_STOWC
    Multiresource Planning (Equal)     SAP_REM_001
    Multiresource Planning (Prim. Resource)     SAP_REM_002
    SNP --> PP/DS Conversion for Many Prods     SAP_SNP_MULT
    Individual Conversion SNP --> PP/DS     SAP_SNP_SNGL
    Planning of Standard Lots (Reuse Mode 4)     SCM_PP_002_4
         SCM_PP_003
         WAVE_DAILY
    Schedule Sequence Manually     ZSAP003
    Stable Forward Scheduling     ZSAP_DS_01
    Enhanced Backward Scheduling     ZSAP_DS_02
         ZSAP_PP_CTP
    TI Planning of Shortage Quantities     ZTI_PP_003
         Z_PP_SPLIT
    Edited by: Sreenivasu on May 20, 2009 1:37 PM

  • Automatic Creation of multiple Transportation Lanes

    Hi all.
    Is it possible to avoid following standard behaviour:
    Change of Supplying Plant in the Special Procurement Type
    If you have changed the supplying plant in the special procurement type in the ERP system, the SCM system creates a new transportation lane for the new combination of supplying plant (from special procurement type) and material/plant. The already existing transportation lane and the now invalid combination of supplying plant and plant in the ERP system is locked for orders in the SAP APO system. This can be seen from the lock indicator X that is set by the system.
    Automatic Creation of Transportation Lanes - Transportation Lane - SAP Library
    Our need for some SKU is to create automatically two T-Lanes. Considering user exit EXIT_SAPLCMAT_001, we added a new line on CT_CIF_MATLOC (and relative CT_CIF_MATLOCX) with different SUPPLPLANT, but the system obviously blocks (SPRKZ) the SKU on one of the two T-Lane.
    Thanks in advance for your support.

    Hi Mauro,
    In my opinion you have to create a program to delete the lock indicator. First you have to extract the information from tr.lanes, then change (delete X indicator) and save. This job should be scheduled before heuristic run.
    To extract data from tr.lanes you can use BAPI_TRLSRVAPS_GETLIST2. To change and save you can use BAPI_TRLSRVAPS_SAVEMULTI2.
    Hope that can help you!
    Thanks.
    Regards, Marius

  • Advantages of using SAP

    hai
    advantages of using SAP some implemented some manufating companys
    sridhar.v
    [email protected]

    Hi Vegendla
    Technology playing a major role in today's business environment. So many companies and corporations have adopted information technology on a large scale by using Enterprise Resource Planning (ERP) systems to accomplish their business transaction and data processing needs. And in this technology SAP R/3 plays a significant role when compared with other similar tools.
    ERP system takes a lead role because of some of the following reasons:
    Many large corporations use several different and separate information systems, often because they have merged with and/or acquired other companies with varied systems. An ERP system integrates these separate information systems and results in improved data reliability and processing efficiency. ERP systems are not only used by large corporations but becoming popular with small to mid-sized companies also.
    Simplify business transaction processing and thus work load is reduced.
    Some of the main advantages of using SAP R/3 are listed below:
    SAP's R/3, introduced in 1992, is the most used ERP system in the world.
    The R/3 software package is designed to allow businesses to effectively and efficiently operate a variety of business processes within a single integrated information system.
    The software is customizable using SAP's proprietary programming language, ABAP/4. R/3 is scalable and highly suited for many types and sizes of organizations and runs on six different platforms.
    SAP’s R/3 has been designed to be the best ERP system in the four areas of human resources, financial, supply chain management, and marketing. R/3 is also an international product, and meets the local fiscal, language, and tax requirements of most countries.
    SAP Manufacturing:
    Drive Manufacturing at the Speed of Business
    Manufacturing isn't getting easier. You're under constant pressure to deliver innovative products, respond to customer demand quickly, and eliminate costs.
    Enter SAP Manufacturing. This powerful solution integrates manufacturing with your other operations, so you can identify changes in demand and supply and rapidly respond to new customer requirements.
    SAP Manufacturing is the only comprehensive solution for managing manufacturing operations with embedded Lean and Six Sigma – empowering you to deliver superior responsiveness and performance. And since it's built on the SAP NetWeaver platform, SAP Manufacturing connects seamlessly with your entire enterprise, including your current plant floor infrastructure. So you can accelerate time-to-value and lower total cost of ownership.
    <b>SAP Manufacturing gives discrete and process manufacturers functionality to:</b>
    Coordinate operations with partners and suppliers
    Detect and resolve exceptions and performance deviation in real time and at low cost
    Institutionalize Lean and Six Sigma processes and monitor production to drive continuous improvement
    Comply with environmental, health, and safety standards
    Improve employee productivity and create a high-quality work environment
    With SAP Manufacturing, your management and production departments gain real-time visibility into key data – enabling them to act quickly. Managers can document, track, and interpret quality and performance using rich analytics capabilities. Production teams can leverage role-based applications for plant managers, production supervisors, maintenance supervisors, and quality inspectors to detect and respond rapidly to exceptions and variances – and deliver superior performance.
    SAP Manufacturing helps you to plan, schedule, sequence, execute, and monitor all your manufacturing processes optimally. So you can achieve higher profits and marketplace wins.
    Reward if useful to u
    null

  • Should I use materialised view?

    I am using the following sql in my code. This takes a long time to execute and I need to tune this. Please review and suggest if I should be using a materialized view instead.
    Main Select statement for interest calculation
    SELECT          intratechgcur.SECURITY, intratechgcur.srl_no, intratechgcur.schg_type,
         CASE WHEN intratechgcur.effective_date < ADt_Start_Date THEN ADt_Start_Date
                             ELSE intratechgcur.effective_date END AS start_date,
         CASE WHEN intratechgcur.effective_date < ADt_End_Date
                             AND NVL(intratechgnext.effective_date, ADt_End_Date) > ADt_End_Date THEN ADt_End_Date
                             ELSE NVL(intratechgnext.effective_date, ADt_End_Date) END AS end_date,
                        intratechgcur.rate, intratechgcur.face_value, intratechgcur.listing_int, intratechgcur.comm_prod_int,
                        intratechgcur.sec_create_int, intratechgcur.int_type, intratechgcur.interest_key, intratechgcur.margin,
                        intratechgcur.FLOOR, intratechgcur.cap, intratechgcur.reset_freq, intratechgcur.cmpd_y_n, intratechgcur.cmpd_freq,
                        intratechgcur.comp_type, intratechgcur.int_day, intratechgcur.int_day_1, intratechgcur.int_day_2, intratechgcur.int_dtls_yn
    FROM               v_intratechg intratechgcur, v_intratechg intratechgnext
    WHERE               intratechgcur.SECURITY          = AS_Security
    AND          intratechgcur.effective_date < ADt_End_Date
    AND               intratechgnext.SECURITY          (+)= intratechgcur.SECURITY
    AND               intratechgnext.srl_no          (+)= intratechgcur.srl_no + 1
    ORDER BY      intratechgcur.SECURITY, intratechgcur.effective_date, intratechgcur.srl_no ;
    The code for the view V_intratechg is;
    CREATE OR REPLACE VIEW V_INTRATECHG AS
    SELECT     security,
         schg_type,
         effective_date,
         SUM(1) over (PARTITION BY security ORDER BY security, effective_date ASC, schg_type ASC) AS srl_no,
         face_value,
         rate,
         listing_int,
         comm_prod_int,
         sec_create_int,
         int_type,
         interest_key,
         margin,
         FLOOR,
         cap,
         NVL(reset_freq, 'DAILY') AS reset_freq,
         NVL(cmpd_y_n, 'N') AS cmpd_y_n,
         NVL(cmpd_freq, 'DAILY') AS cmpd_freq,
         NVL(comp_type, 'N') AS comp_type,
         int_day, int_day_1, int_day_2, int_dtls_yn
    FROM
         (SELECT     security.security, 'IM' AS schg_type,
              GREATEST(security.prv_int_dt, NVL(security.allot_date, security.prv_int_dt),
              NVL(security.first_int_date,security.prv_int_dt)) AS effective_date,
              DECODE(intday.int_day_1, 'ACD', NVL((SELECT interest_amt FROM securityschddtls A WHERE security.security = A.security
              AND A.adhoc_schd_date > GREATEST(security.prv_int_dt, NVL(security.allot_date, security.prv_int_dt),
              NVL(security.first_int_date,security.prv_int_dt))
              AND a.rectype ='L' AND A.ADHOC_SCHD_DATE = (SELECT MIN(ADHOC_SCHD_DATE) FROM securityschddtls
    WHERE      securityschddtls.adhoc_schd_date > GREATEST(security.prv_int_dt, NVL(security.allot_date, security.prv_int_dt), NVL(security.first_int_date,security.prv_int_dt))
         AND securityschddtls.security = A.security AND securityschddtls.rectype='L')),
              NVL(secchg.rate, security.interest)), NVL(secchg.rate, security.interest)) AS rate,
              NVL(secchg.face_value, security.face_value) AS face_value,
              NVL(secchg.listing_int, security.listing_int) AS listing_int,
              NVL(secchg.comm_prod_int, security.comm_prod_int) AS comm_prod_int,
              NVL(secchg.sec_create_int,security.sec_create_int) AS sec_create_int,
              NVL(secchg.int_type, security.int_type) AS int_type,
              NVL(secchg.interest_key, security.interest_key) AS interest_key,
              NVL(secchg.margin, security.margin) AS margin,
              NVL(secchg.FLOOR, security.FLOOR) AS FLOOR,
              NVL(secchg.cap, security.cap) AS cap,
              NVL(secchg.reset_freq, security.reset_freq) AS reset_freq,
              NVL(secchg.cmpd_y_n, security.cmpd_y_n) AS cmpd_y_n,
              NVL(secchg.cmpd_freq, security.cmpd_freq) AS cmpd_freq,
              NVL(secchg.comp_type, security.comp_type) AS comp_type,
              NVL(secchg.int_day, security.int_day) AS int_day, intday.int_day_1,
              intday.int_day_2, 'Y' AS int_dtls_yn
              FROM          security, assetype, intday, securityschddtls secdtls,
                        (SELECT     secchg.security AS security, secchg.call_date AS effective_date,
                        NVL(secchg.rate,0) AS rate, secchg.face_value,
                        SUM(1) over (PARTITION BY secchg.security ORDER BY secchg.security,
                        secchg.call_date ASC) AS srl_no,
                        NVL(secchg.listing_int,0) AS listing_int, NVL(secchg.comm_prod_int,0) AS comm_prod_int,
                        NVL(secchg.sec_create_int,0) AS sec_create_int,
                        secchg.int_type, secchg.interest_key,
                        nvl(secchg.margin,0) as margin, nvl(secchg.FLOOR,0) as floor,
                        nvl(secchg.cap,0) as cap, secchg.reset_freq,
                        secchg.cmpd_y_n, secchg.cmpd_freq, secchg.comp_type, secchg.int_day FROM          secchg) secchg
              WHERE          security.asset_type     = assetype.asset_type
                   AND          security.int_day          = intday.int_day
                   AND          assetype.int_y_n           = 'Y'
                   AND          security.rectype          = 'L'
                   AND          assetype.rectype          = 'L'
                   AND          intday.rectype               = 'L'
                   AND          secchg.security (+)= security.security
                        AND          secchg.srl_no (+)= 1
                        AND          secdtls.security (+)= security.security
                        AND          secdtls.srl_no (+)= 1
                        AND          secdtls.rectype (+)= 'L'
              UNION ALL
              SELECT     schedules.security,
                   DECODE(schedules.schd_past_yn, 'Y', 'RP', 'RS') AS schg_type,
                   DECODE(intday.int_day_1, 'ACD',security_cashflow.start_date,security_cashflow.inflow_date) AS effective_date,
                   --commented by vijai
                   -- DECODE(intday.int_day_1, 'ACD', intschdamt.amount, NVL(intratechg.rate,security.interest)) AS rate,
                   DECODE(intday.int_day_1, 'ACD', intschdamt.amount,decode(security_cashflow.start_Date,intratechg.value_Date, intratechg.rate, security.interest)) as rate,
                   decode(nvl(schedules.tot_face_value - schedules.cum_face_value,security.face_value),0,security.face_value,schedules.tot_face_value - schedules.cum_face_value,security.face_value) AS face_value,
                   NVL(intratechg.listing_int,security.listing_int) as listing_int,
                   NVL(intratechg.comm_prod_int,security.comm_prod_int) as comm_prod_int,
                   NVL(intratechg.sec_create_int,security.sec_create_int),
                   NVL(intratechg.int_type,security.int_type) as int_type,
                   nvl(intratechg.interest_key,security.interest_key) as interest_key,
                   nvl(intratechg.margin,security.margin) as margin,
                   nvl(intratechg.FLOOR,security.floor) as floor,
                   nvl(intratechg.cap,security.cap) as cap,
                   nvl(intratechg.reset_freq,security.reset_freq) as reset_freq,
                   nvl(intratechg.cmpd_y_n,security.cmpd_y_n) as cmpd_y_n,
                   nvl(intratechg.cmpd_freq,security.cmpd_freq) as cmpd_freq,
                   nvl(intratechg.comp_type,security.comp_type),
                   nvl(intratechg.int_day,security.int_day),
                   intday.int_day_1, intday.int_day_2,
                   DECODE(intratechg.security, NULL, 'N', 'Y') AS int_dtls_yn
              FROM     v_schedules schedules, security, intday, intratechg, v_schedules intschdamt, security_cashflow
              WHERE     schedules.security          = security.security
              AND          schedules.red_yn      = 'Y'
              AND          security.int_day               = intday.int_day
              AND          security.rectype               = 'L'
              AND          intday.rectype                    = 'L'
              AND          intratechg.security (+)= schedules.security
              AND          intratechg.value_date(+)= schedules.schd_date
              AND          intratechg.rectype     (+)= 'L'
              AND          intschdamt.security (+)= schedules.security
              AND          intschdamt.schd_date (+)= schedules.schd_date
              AND          intschdamt.red_yn (+)= 'N'
              AND           security_cashflow.inflow_type      = 'INT'
              AND           security_cashflow.inflow_date     = schedules.schd_date
              AND           security.security               = security_cashflow.security
              AND           schedules.security          = security_cashflow.security
              UNION ALL
              SELECT     intratechg.security, 'IR' AS schg_type,
                   intratechg.value_date AS effective_date,
                   NVL(intratechg.rate,security.interest),
                   security.face_value,
                   NVL(intratechg.listing_int,security.listing_int),
                   NVL(intratechg.comm_prod_int,security.comm_prod_int),
                   NVL(intratechg.sec_create_int,security.sec_create_int),
                   nvl(intratechg.int_type,security.int_type),
                   nvl(intratechg.interest_key,security.interest_key),
                   nvl(intratechg.margin,security.margin),
                   nvl(intratechg.FLOOR,security.floor),
                   nvl(intratechg.cap,security.cap),
                   nvl(intratechg.reset_freq,security.reset_freq),
                   nvl(intratechg.cmpd_y_n,security.cmpd_y_n),
                   nvl(intratechg.cmpd_freq,security.cmpd_freq),
                   nvl(intratechg.comp_type,security.comp_type),
                   nvl(intratechg.int_day,security.int_day),
                   intday.int_day_1, intday.int_day_2, 'Y' AS int_dtls_yn
              FROM     intratechg, security, intday
              WHERE     intratechg.security          = security.security
              AND     security.int_day               = intday.int_day
              AND     intratechg.rectype          = 'L'
              AND     security.rectype               = 'L'
              AND     intday.rectype                    = 'L'
              AND     NOT EXISTS     (SELECT     1 FROM          v_schedules schedules
                             WHERE          schedules.security     = intratechg.security
                             AND          schedules.schd_date     = intratechg.value_date
                             AND          schedules.red_yn          = 'Y'))
              ORDER BY security, srl_no
    The code for the view V_schedules is;
    CREATE OR REPLACE VIEW V_SCHEDULES AS
    SELECT schdall.security,
              schdall.schd_date,
              schdall.schd_type,
              schdall.percent,
              schdall.units_o,
              schdall.units_n,
              schdall.amount,
              schdall.sequences,
    schdall.act_sch_dt,
         schdall.security_n,
              schdall.prior_act,
         schdall.red_amount,
              schdall.ben_refer,
         schdall.round_method,
    schdall.round_dec,
    schdall.average_y_n,
         schdall.schd_past_yn,
         CASE WHEN schd_type IN(sysschd.red, sysschd.disred) THEN 'Y' ELSE 'N' END AS red_yn,
         SUM( CASE WHEN schd_type IN(sysschd.red, sysschd.disred) THEN schdall.red_amount ELSE 0 END)
                                  over(PARTITION BY schdall.security) AS tot_face_value,
    SUM( CASE WHEN schd_type IN(sysschd.red, sysschd.disred) THEN schdall.red_amount ELSE 0 END)
                                  over(PARTITION BY schdall.security
                                       ORDER BY schdall.security, schdall.schd_date ASC) AS cum_face_value,
         SUM( CASE WHEN schd_type IN(sysschd.red, sysschd.disred) THEN schdall.red_amount ELSE 0 END)
                                       over(PARTITION BY schdall.security
                                       ORDER BY schdall.security, schdall.schd_date DESC) AS to_be_redeemed ,
              SUM(CASE WHEN schd_type =sysschd.INT THEN 0 ELSE 1 END)
                                       over(PARTITION BY schdall.security,schdall.schd_date,schd_type)
                             AS no_of_schd
    FROM
                   (SELECT      schedules.security_o AS security,
                                  schedules.schd_date,
                                  schedules.schd_type,
                                  schedules.percent,
                                  schedules.units_o,
                                  schedules.units_n,
                                  schedules.amount,
                                  schedules.sequences,
                                  schedules.act_sch_dt,
                                  schedules.security_n,
                                  schedules.prior_act,
                                  schedules.red_amount,
                                  schedules.ben_refer,
                                  schedules.round_method,
                                  schedules.round_dec,
                                  schedules.average_y_n,
                                  DECODE(schedules.schd_type,'RED','Y','Y') AS schd_past_yn
              FROM           schdpast schedules
              WHERE           prior_act = 'A'
              AND                rectype = 'L'
              UNION ALL
              SELECT           schedules.security_o AS security,
                                  schedules.schd_date,
                                  schedules.schd_type,
                                  schedules.percent,
                             schedules.units_o,
                   schedules.units_n,
                             schedules.amount,
                        schedules.sequences,
                        schedules.act_sch_dt,
                   schedules.security_n,
                   schedules.prior_act,
                        schedules.red_amount,
                        schedules.ben_refer,
                   schedules.round_method,
                   schedules.round_dec,
                   schedules.average_y_n,
                        'N' AS schd_past_yn
              FROM           schedules
              WHERE           prior_act = 'A'
              AND                rectype = 'L'
              AND                Process_date IS NULL ) schdall,
              (SELECT           MAX(redschdtype) AS red,
                             MAX(disredtype) AS disred,
                                  MAX(intschdtype) AS      INT
                                  FROM sysparamschd
              WHERE rectype = 'L') sysschd
    ORDER BY security, schd_date, schd_type

    Too much SQL... makes me eyes hurt.
    I think you're running down the wrong alley here. The very first and fundamental principle of performance tuning is identifying the performance problem. Saying that there is a problem is not identifying the actual problem.
    You cannot run down the alley with a knife looking for a performance problem to kill if you do not know how it looks like. Good that you are running though - the old Klingon saying of "a running warrior can slit more throats" hold very true. :-)
    Why is the existing SQL slow? You first need to identify that. Sure, a materialised view can make the end-query much faster as it has no longer to do all the work - that has now been done in batch by a DBMS_REFRESH job updating and maintaining that materialised view. But that work is still done... so have you actually fixed the cause of the performance problem, or merely hid it by addressing the symptoms?
    How does one find and identify the underlaying performance problem with too-much-SQL-that-makes-Billy's-eyes-hurt? Software Engineering 101. Take any complex problem. Break it down into lots of smaller little problems. Solve each on in turn.
    Take the SQL, break it down into simpler pieces and check each for performance issues. Look at the execution plan and cost. Determime if you (via the physical db design) are providing optimal I/O paths to the CBO in order for it to get to the required data with as little I/O as possible.
    Once you deal with the facts, you can make an informed decision or whether or not a materialised view will actually fix the cause of the performance problem.

Maybe you are looking for

  • Po with zero net price

    Dear Experts, How to set 100% discount or free of charge item category to allow zero net price? Thanks & B.Regards

  • The precondition on the request for the URL / evaluated to false

    Hi, I get error message when connect on secure 443 port: "The precondition on the request for the URL / evaluated to false." Problem in: <Location /> SetHandler weblogic-handler WLExcludePathOrMimeType /DocumentServer </Location> It works in httpd.co

  • Ultra 2 (Solaris 8) keeps rebooting

    I'm really new to Solaris. Just installed Solaris 8 on an Ultra Enterprise 2 which has two SCSI hard drives. The first drive (1GB) holds the swap partition and the second drive (9GB) holds the Solaris 8 installation. After doing a Stop-A to get to th

  • Memory Leak in Applet

    Hello Good people, I am facing a troubling memory problem in my applet. Apparently, it suffers from some major memory leaks and every time I reload my applet the memory is consumed with additional 5Mb. I am looking for ways to work around this (or be

  • AET for CRM 7 not defaulting in the Package...[RESOLVED]

    We introduced a new config/development client several weeks back and now all development/config takes place in client 010 rather than client 100. However, today is the first time that I have needed to use the AET tool to create a new field. When doin