Exception Message Selection Group

Hi all,
I'm trying to create exception messages with MRP/MPS run under selection group 5(Exception during BOM explosion) and 6 Exception during availability check. Can someone pls let me know of when such an exception/error message can be triggerd?
Thanks and Regards
Deepak Prasanna S

Dear,
If you donot know when this EM should appear why are you changing it?
anyway...explanation is as below
5 and 6 triggers in the following condition
EMGroup  -5
                EM           text-when this mesages apprearas
     50     No BOM exists
     52     No BOM selected
     53     No BOM explosion due to missing config.
     54     No valid run schedule header
     55     Phantom assembly not exploded
EMGroup  -6          
25     Excess stock
     26     Excess in individual segment
     40     Coverage not provided by master plan
     50     Shortage in the planning time fence
     57     Disc. matl partly replaced by follow-up
     58     Uncovered reqmt after effective-out date
     59     Receipt after effective-out date
     70     Max. release qty - quota exceeded
     96     Stock fallen below safety stock level
I hope u understood....please come back if required
Edited by: Rajesha Vittal on Dec 21, 2007 8:11 PM

Similar Messages

  • MRP exception message configuration in SPRO

    Hi all,
    Please advise where we can do configuration settings of exception message in SPRO.

    Please check the first link of my post. Path and usefull info is mentioned there:
    MRP exception message:
    spro -> pp -> mrp -> evaluation -> exception messages -> define & group exception messages.
    Define and Group Exception Messages
    In this step, you define the following parameters for exception messages:
    Whether exception messages are displayed for particular exception situations
    If a particular exception message is not relevant to your company, select the field No exception message. In the planning run, this exception message is then no longer created for this situation.
    The priority in which exception messages are to be displayed
    If several exception messages exist for one MRP element, you can assign priorities to determine which exception message is to be displayed in the MRP evaluations. The system always displays the exception message with the highest priority directly in the list. The exception message selected with the next highest priority can be displayed in the list by accessing the additional data.
    You enter the priority of the exception messages in the field entitled Excep.mssge priority.
    You can see the sequence of priorities by selecting the possible entries pushbutton on the input field. Thus, you can gain an overview of the previous sequence of the exception messages. The exception messages with the higher number also has higher priority.
    How exception messages are grouped to exception groups
    For the collective display of the MRP list and the stock/requirements list, as well as for all material lists created as a result of the single-item, multi-level planning run, exception messages are grouped into exception groups. In the standard system, a grouping exists that you can change, if necessary, in the field entitled Selection group. You can adapt the long text of the exception group in the step Check Exception Group Texts.
    Depending on which exception messages MRP lists are created
    In the initial screen of the planning run as well as in in the MRP group, you can define that the system is only to create an MRP list if certain exceptional situations exist (creation indicator "Create MRP list - depending on exception messages"). The exception messages that lead to the creation of the MRP list are selected in the field entitled Create MRP list.
    Actions
    1. Define whether the exception message is set.
    2. Define the priority of the exception message.
    3. If necessary, change the exception groups.
    4. If necessary, select the exception for the creation of the MRP lists depending on the exception messages.
    Edited by: Afshad Irani on Jun 3, 2010 4:27 PM

  • When using mail icon i get a blank screen with No message selected on the RH side. Top left is the word thread in  black . all other buttons are greyed out except the send new mail one. Cna anyone help?

    Email does not appear when using the mail icon on the home screen. I get No message selected showing on the rh side of my screen with the left hand third of the screen blank. Buttons on the top line are greyed out except the new mail one. The word thread appears in black on the top left hand side of the screen The only way out is to close the screen. all other apps work okay.

    Hello calverone,
    Thanks for using Apple Support Communities.
    To start troubleshooting this issue where the Mail application is not appearing correctly on your iPad, I'd like you to please force the Mail app to quit, and then restart your iPad.
    iOS: Force an app to close
    Turn your iOS device off and on (restart) and reset
    Have a great weekend,
    Alex H.

  • MRP exception message 64 and planning strategy group 52

    Hi Gurus,
    I have done extensive search online in the forum to find the route cause why we are getting MRP exception message 64 for a specific material in one of our plants. This exception message does not occur for the same materials which is also produced in another plant.
    I was just wondering whether the planning strategy group of 52 in MRP 3 view would have any effect on the frequent occurrence of exception message 64. I know that the 64 message occurs when the routing time is higher than the in house production time. If that's the case where to look for in routing to correct this, apart from this do we need to look at work centers and other details. I'm not a  PP person but still was curious to know see if i could take a shot at it.
    Also the MRP settings that we follow in the plant where this problem does not occur is NETCH, Create PR - 2, Schedule lines - 3, create MRP list - 1, Planning mode - 3, scheduling -2
    in the plant where the 64 message occurs quite often is Netch, Create PR -2, Schedule lines - 3, create MRP list - 1, planning mode - 1, Schdeduliing - 1
    I was  thinking do MRP settings and planning strategy group would have any impact on why we are getting the 64 wexception message
    Because of this 63 exception message, the downstream components are getting wrong signals.
    Thanks
    Ravi

    Hello Ravi
    Generallt, exception message "64 - Production finish after order finish" is triggered when the order start date is in the past and system automatically changes to forward scheduling to calculate the finish date.
    Note 1913017 explains how the order basic date is calculated and adjusted in case of forward scheduling, however, you are using strategy 52 and this is a very special scenario, whever VP planned orders are generated.
    The VP planned orders will always be adjusted to the requirements date even if the requirements date is in the past. This is a special feature in the planning segment, since these orders are only kind of 'virtual' planned orders. These orders only have to provide the demand requirements for the components in time.
    Therefore, there is a relationship between strategy 52 (VP planned order) and the exception message observed.
    BR
    Caetano

  • What table are Exception Messages in MRP stored?

    The requirement is to develop an error report from an MRP run to capture the exception messages along with the selection groups.
    Ex:Selection Gr 2; Exception Message 15: Reschedules In.
    I am unable to track where exactly the exception messages are stored after an MRP run. Any suggestions as to how to go about this requirement.
    Thank You.

    You can basically get a list of all tables MD06 (colelctive MRP list) uses to fetch data. GO to tran se30. Under Measurement restrictions click new and in Duration/Type tab select none. Go back to se30 main screen enter tran MD06 and execute. It will take you to MD06, run it with any material and go back to se30 screen. At the botton select evaluate and on the evaluation screen select "Data base hit list" or F6. That will give a list of all tables accessed by MD06. SO basically you will know all the tables that were filled during last MRP run.
    Atul

  • Transaction code to display exception messages by material and plant

    Hi,
    Is there a transaction code or standard report in SAP  to display exception messages by material and plant? I see the exception messages by individual material and plant in MD04 but I need to see a collective view. I tried Collective access in MD04 and MD46 but they are not giving me exception groups but I need exceptions listed out by material and plant.
    Thanks.

    Visu,
    I have never seen such a report.
    MD06 does support fine tuning the output display, once the list has been generated.  If you use this feature, the resulting display is the entire list as created by selecting the initial parameters (such as exception group), but with the specific items that contain your selected message highlighted.  If you are addressing the messages interactively, you can select the review (glasses)  screens, and scroll through just the ones which contain your  selected exception message(s).
    To try this, execute MD06.  Select the groups as necessary.  Execute.  Wait for the list.  Now, immediately, select 'search' (binoculars).  Experiment with the output.
    As mentioned in the previous post, if MD06 does not meet your needs, you will need to have a custom report written.
    Rgds,
    DB49

  • If I do NOT use any event, except AT SELECTION SCREEN, Do I get any issues?

    Hi Experts,
    Pls. let me know that, If I do NOT use any event, except AT SELECTION SCREEN, Do I/prog. get any issues? (am also using AT SELECTION SCREEN OUTPUT for list box preperation).
    For some reason(execution of the report prog. with ENTER button), am using ONLY these 2 events.
    For full detials, pls. see my other thread with title,
    Is it possible to execute a REPORT prog. with pressing of ENTER button?
    thanq

    Hi
    srinivas see this program
    i am executing this program with out any event it is not showing any error but not giving output
    when i put start-of-selection then it is showing output
    *& Report  ZNNR_REPORT33
    REPORT  ZNNR_REPORT33 NO STANDARD PAGE HEADING MESSAGE-ID ZNNR LINE-SIZE 100 LINE-COUNT 65(4).
    ******DATA DECLARATIONS**********
    DATA : BEGIN OF IT_PLANT OCCURS 0,
            MATNR LIKE MARA-MATNR,
            WERKS LIKE MARC-WERKS,
            PSTAT LIKE MARC-PSTAT,
            EKGRP LIKE MARC-EKGRP,
           END OF IT_PLANT.
    DATA : BEGIN OF IT_PONO OCCURS 0,
            EBELN LIKE EKKO-EBELN,
            EBELP LIKE EKPO-EBELP,
            MATNR LIKE EKPO-MATNR,
            WERKS LIKE EKPO-WERKS,
            LGORT LIKE EKPO-LGORT,
           END OF IT_PONO.
    TABLES EKKO.
    ********END OF DATA DECLARATIONS*********
    ********SELECTION SCREEN DESIGN ***********
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETER : P_WERKS LIKE MARC-WERKS MODIF ID S1.
    SELECT-OPTIONS : S_EBELN FOR EKKO-EBELN NO INTERVALS MODIF ID S2.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-004.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS : R1 RADIOBUTTON GROUP G1 DEFAULT 'X' user-command uc1.
    SELECTION-SCREEN COMMENT 5(20) TEXT-002 FOR FIELD R1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS : R2 RADIOBUTTON GROUP G1.
    SELECTION-SCREEN COMMENT 5(20) TEXT-003 FOR FIELD R2.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK B2.
    ******END OF SELECTION SCREEN DESIGN****************
    ***********SCREEN MODIFICATIONS*******************
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF R1 EQ 'X' AND SCREEN-GROUP1 EQ 'S2'.
          SCREEN-INPUT = 0.
          MODIFY SCREEN.
        ENDIF.
        IF R2 EQ 'X' AND SCREEN-GROUP1 EQ 'S1'.
          SCREEN-INPUT = 0.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    ********END OF SCREEN MODIFICATIONS*****************
    ***************SCREEN VALIDATIONS *****************
    at selection-screen.
      SELECT SINGLE *
               FROM EKKO
               INTO EKKO
               WHERE EBELN IN S_EBELN.
      IF SY-SUBRC <> 0.
        SET CURSOR FIELD 'S_EBELN-LOW'.
        MESSAGE E999 WITH TEXT-005.
        clear S_ebeln-low.
      ENDIF.
    ********end of screen validation*****************
      IF R1 EQ 'X'.
    *ULINE AT /1(48).
        WRITE : SY-VLINE ,2 'MATERIAL NUMBER',
                21 SY-VLINE , 22 'PLANT',
                27 SY-VLINE , 28 'STATUS',
                43 SY-VLINE , 44 'GRUP', 48 SY-VLINE.
        ULINE AT /1(48).
      ENDIF.
      IF R2 EQ 'X'.
        WRITE : SY-VLINE , 2 'PO NUMBER',
               12 SY-VLINE, 13 'ITEM',
               18 SY-VLINE,19 'MATERIAL NUMBER',
               37 SY-VLINE, 38 'PLANT',
               44 SY-VLINE, 45 'GRUP',
               49 SY-VLINE.
        ULINE AT /1(50).
      ENDIF.
    start-of-selection.
    *set pf-status '100'.
      IF R1 EQ 'X'.
        SELECT MATNR
               WERKS
               PSTAT
               EKGRP
           FROM MARC
           INTO TABLE IT_PLANT
           WHERE WERKS = P_WERKS.
        LOOP AT IT_PLANT.
          WRITE : SY-VLINE , 2 IT_PLANT-MATNR COLOR COL_KEY,
                 21 SY-VLINE , 22  IT_PLANT-WERKS COLOR COL_KEY,
                 27 SY-VLINE ,28 IT_PLANT-PSTAT COLOR COL_NORMAL,
                 43 SY-VLINE ,44 IT_PLANT-EKGRP COLOR COL_NORMAL.
        ENDLOOP.
      ENDIF.
      IF R2 EQ 'X'.
        SELECT EBELN EBELP MATNR WERKS LGORT
               FROM EKPO
               INTO TABLE IT_PONO
               WHERE EBELN IN S_EBELN.
        LOOP AT IT_PONO.
          WRITE : SY-VLINE , 2 IT_PONO-EBELN COLOR COL_KEY,
                 12 SY-VLINE , 13 IT_PONO-EBELP COLOR COL_KEY,
                 18 SY-VLINE , 19 IT_PONO-MATNR COLOR COL_NORMAL,
                 37 SY-VLINE , 38 IT_PONO-WERKS COLOR COL_NORMAL,
                 44 SY-VLINE , 45 IT_PONO-LGORT COLOR COL_NORMAL, 49 SY-VLINE..
        ENDLOOP.
      ENDIF.
      ULINE AT /1(50).
      WRITE :/10 'PAGE NUMBER', SY-PAGNO, '/' ,SY-PAGNO.
      ULINE AT /1(50).
      WRITE :/10 'PAGE NUMBER', SY-PAGNO.

  • MRP Exception Messages

    Hi Gurus , i need your help
    A summary of exception messages can be viewed in MD07,
    butit is only by MRP controller.  Is it possible to view all exception
    messages for a plant?  Are there any plant level metrics that can show
    the performance of our SAP MRP data.
    Thanks in advance .
    Points will be rewarded.

    Hi,
    pls try below selection method in TCode MD06
    then you will get exception message list of materails only within plant (don't enter MRP controller, enter only plant)
    MD06 --> Plant --> Tab Restrict Selection --> Exception Groups --> select all group ( check box tick 1 to 8 ) --> then Excute
    it will solve your problem
    Regards,
    Sankaran

  • Sorting exceptional messages in md06

    Is it possible to sort according to exceptional message numbers in md06. i have got more message no. 20, i like to sort and delete the same. pls advise how to do that?

    YS,
    I don't know how to delete an exception message.  I can't imagine why you would want to delete an exception message.  They will simply be recreated on the next MRP run until you fix the underlying problem.
    I DO know how to filter the output such that all 'non-20-message-type-materials' are highlighted in the results screen.  Then you can scroll from material to material to see each MD05 screen which contains the offending plans. 
    MD06>select the message groups that you wish to display.  I personally like to see 6 and 7.  Instructions were kindly provided in a previous response by Rammohan and Sankaran.
    On the next screen, you will see the list of materials which contain the messages you had selected.  Now, hit CTRL-F or clik on the binoculars.  If it is a big list, you will get a popup, clik through.
    Now you are on the 'Find' popup.  select the "Find Exceptions" tab.  You will see a statistical listing of all the exception messages summarized.  Select all but '20', hit the green check.
    All materials will be displayed that don't have a 20 message.  Hit F5 or clik on the glasses(display MRP list).  You will be taken to the first MD05 that was highlighted.  Fix the problem as necessary.  Now hit CTRL-F2 or clik on the small right arrow on the Icon bar.  This will take you to the next MD05.  Continue until done.
    Regards,
    DB49

  • Selection group in MRP run MD01

    Dear all,
    While running MD01, It displays the selection group 1,2,3,4,5,6,7,8
    What is this selection group, what is the meaning , Sometime these numbers are in red, what does it indicate
    Please guide me
    Subbu.

    Are u you talking about exception groups in the results.  They are just grouping of exception messages  ( which you can modify if needed,  but mostly are grouped in the right way by SAP itself)
    cheers
    Rav

  • Regrouping of MRP exception messages

    Hi Gurus,
    Can anybody please help me with this issue. The business has requested to regroup the exception messages arising in MD04/MD06. Currently there are 8 selection groups into which all the MRP exception messages are put in. The business wants to move some messages in to different selection groups. Can anybody please let me know what are the implications of doing this? The reason the business has asked for this is that they feel that there are so many unused selection groups and they want to organize the messages as per the title/name. for example Reschedule in (message no 10) and reschedule out (message no 15), they want to separate these into two groups. Once group called expedite which will contain message 10 and anothet group called deexpedite which will contain message 15. sinmilarly for other messages. Please throw some light on this. Help is greatly appreciated.
    Thanks
    Anusha

    Dear,
    There is no the implications of doing this but note that most of exception message functionallity is hard-coded in MRP.
    OMD3 and OM0L are the places you can make the possible changes.
    Or you need to go for develpment with MD_STOCK_REQUIREMENTS_LIST_API
    Use the BAPI_MATERIAL_MRP_LIST where AUSSL Exception message key. You will get all details
    Regards,
    R.Brahmankar

  • View & Action Cross Plant MRP Exception Messages

    We have a centralised storage facility and we have chosen to control all of the conversion of Planned Orders to Requsitions and then on to Stock Transfer Orders from the Supplying Plant. However we do not currently have the ability to view and action MRP Exception Messages from the Ordering Plants.
    We use MD06 to action the Supplying Site MRP Exceptions but this can only look at one Plant at a time.
    Does anyone know a way of viewing and actioning MRP Messages across multiple Plants?

    Hi,
    pls try below selection method in TCode MD06
    then you will get exception message list of materails only within plant (don't enter MRP controller, enter only plant)
    MD06 --> Plant --> Tab Restrict Selection --> Exception Groups --> select all group ( check box tick 1 to 8 ) --> then Excute
    it will solve your problem
    Regards,
    Sankaran

  • Error: There was a failure to call cluster code from a provider. Exception message: Generic failure . Status code: 5015. SQL 2012 SP1

    Hi,
    Please help. I was trying to remove a SQL 2012 SP1 two node clustered instance using setup (Mantenance -> Remove Node)
    I started by doing this on passive node (and was successful) but when I ran setup on active node just before finishing successfully I got this error:
    TITLE: Microsoft SQL Server 2012 Service Pack 1 Setup
    The following error has occurred:
    The resource 'BCK_SG1DB' could not be moved from cluster group 'SQL Server (SG1DB)' to cluster group 'Available Storage'. 
    Error: There was a failure to call cluster code from a provider. Exception message: Generic failure . Status code: 5015.
    Description: The operation failed because either the specified cluster node is not the owner of the resource, or the node
    is not a possible owner of the resource.
    For help, click:
    http://go.microsoft.com/fwlink?LinkID=20476&ProdName=Microsoft%20SQL%20Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=11.0.3000.0&EvtType=0xE8049925%25400x42B4DED7
    BUTTONS:
    OK
    I noticed that SG1DB instance was removed on both nodes but on Failover Cluster Manager -> Services and Applications the SQL server instance for SG1DB is still there. So I tried to delete it but got the error:
    Failed to delete SQL Server SG1DB. An error was encountered while deleting the cluster service or
    application SQL Server SG1DB. Could not move the resource to available storage. An error occured
    while moving the resource BCK_SG1DB to the clustered service or application Available Storage
    Any ideas why it failed or how could I delete the SQL server instance from Clauster?
    Thx

    Hello,
    Please read the following resource.
    https://support.microsoft.com/en-us/kb/kbview/313882?wa=wsignin1.0
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • The underlying connection was closed: An unexpected error occurred on a receive..Exception.Message - while executing powershell command for sharepoint online site

    " +The underlying connection was closed: An unexpected error occurred on a receive..Exception.Message " OR sometimes
    "The remote server returned an error: (503) Server Unavailable..Exception.Message"
    Getting exception above when performing various operation (site coll creating, group creation, adding users to group) for sharepoint online (Office 365) site using powershell script.
    I want to create 3500 site collections using PS script. In-between getting above exception so it will skip one site collection creating and working again. for eg. after creating 11 site coll, script will through above exception and so 12th site coll will
    not be create but working fine from 13 and so on...

    Remote server seems working to me...any additional check?
    if problem with remote server then may be loop to create site provisioning should not start again..Right?
    any idea?

  • Why am i not able to see the exception message?

    i wrote an 'instead of insert' trigger on a view.
    and there are some exception situations in which the insertion should be stopped. my trigger works correctly. i mean it implements its purpose. however, the message i am taking after the trigger execution is not satisfying. ( i am using iSQL*Plus as the editor.)
    here is my trigger: (after trigger there is some extra explanation below.)
    CREATE OR REPLACE TRIGGER DemandOfCourses_T1_II
    INSTEAD OF INSERT ON DemandOfCourses
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
         cpc NUMBER;
         currentNum NUMBER;
    stud1 NUMBER;
         stud2 NUMBER;
         prec     NUMBER;
    exc1 EXCEPTION;
    exc2 EXCEPTION;
    BEGIN
         SELECT capacity
         INTO cpc
         FROM LimitedCourse
         WHERE course = :NEW.course;
         IF cpc IS NULL THEN
              cpc := 1000;
         END IF;
         SELECT COUNT(course)
    INTO currentNum
    FROM Registered
    WHERE course = :NEW.course;
         SELECT COUNT(student)
         INTO stud1
         FROM Registered
         WHERE student = :NEW.student
         AND course = :NEW.course;
         SELECT COUNT(student)
         INTO stud2
         FROM WaitingFor
         WHERE student = :NEW.student
         AND course = :NEW.course;
         SELECT COUNT(hp.preCourse)
         INTO prec
         FROM HasPrereq hp
         WHERE hp.course = :NEW.course
         AND hp.preCourse NOT IN (SELECT course FROM CourseResult WHERE student = :NEW.student);
         IF (prec = 0) THEN
         IF (stud1 = 0) AND (stud2 = 0) THEN
         IF (currentNum = cpc) THEN
              INSERT INTO WaitingFor
              VALUES (:NEW.student, :NEW.course, SYSDATE);
         ELSE
              INSERT INTO Registered
              VALUES (:NEW.student, :NEW.course);
         END IF;
         ELSE
         RAISE exc1;
         END IF;
         ELSE
         RAISE exc2;
         END IF;
         EXCEPTION
         WHEN exc1 THEN
              RAISE_APPLICATION_ERROR (-20002, 'Already registered for this course.');
         WHEN exc2 THEN
              RAISE_APPLICATION_ERROR (-20003, 'First the prerequesite course(s) must be taken.');
         WHEN NO_DATA_FOUND THEN
              NULL;
    END;
    for eample, if i want to insert the row below:
    INSERT INTO DemandOfCourses VALUES (100005, 'BAK127', 'REGISTERED');
    -- 100005 : STUDENT ID
    -- BAK127 : COURSE CODE
    -- REGISTERED : SITUATION
    when i run this insert comment, i receive this result:
    1 row created.
    Actually, it should not insert anything. and it is not inserting anything. i mean, it is working correctly. however, i want it to write my exception message: "-20003, 'First the prerequesite course(s) must be taken.'"
    why cannot i see my expected exception message?
    all the data and structure is certainly true. if you have a question about them, i can answer.
    by the way, i will catch this exception from my java code. what should i do in this situation?
    any help will be appreciated.
    regards

    Hi,
    i don't understand your logic.
    See, I added output to trace the counters value :
    SQL> drop table courses cascade constraints;
    Table dropped.
    SQL> CREATE TABLE Courses (
      2  code VARCHAR2(15),
      3  name VARCHAR2(40) NOT NULL,
      4  credit NUMBER(2) CHECK (credit BETWEEN 1 AND 20),
      5  PRIMARY KEY (code)
      6  );
    Table created.
    SQL>
    SQL> drop table LimitedCourse;
    Table dropped.
    SQL> CREATE TABLE LimitedCourse (
      2  course VARCHAR2(15),
      3  capacity NUMBER(3) NOT NULL,
      4  PRIMARY KEY (course),
      5  FOREIGN KEY (course) REFERENCES Courses(code)
      6  );
    Table created.
    SQL>
    SQL> drop table Registered;
    Table dropped.
    SQL> CREATE TABLE Registered (
      2  student NUMBER(6),
      3  course VARCHAR2(15),
      4  PRIMARY KEY (student, course),
      5  --FOREIGN KEY (student) REFERENCES Students(studentID),
      6  FOREIGN KEY (course) REFERENCES Courses(code)
      7  );
    Table created.
    SQL>
    SQL> drop table WaitingFor;
    Table dropped.
    SQL> CREATE TABLE WaitingFor (
      2  student NUMBER(6),
      3  course VARCHAR2(15),
      4  regisDate TIMESTAMP NOT NULL,
      5  PRIMARY KEY (student, course),
      6  --FOREIGN KEY (student) REFERENCES Students(studentID),
      7  FOREIGN KEY (course) REFERENCES Courses(code)
      8  );
    Table created.
    SQL>
    SQL> drop table HasPrereq ;
    Table dropped.
    SQL> CREATE TABLE HasPrereq (
      2  course VARCHAR2(15),
      3  preCourse VARCHAR2(15),
      4  PRIMARY KEY (course, preCourse),
      5  FOREIGN KEY (course) REFERENCES Courses(code),
      6  FOREIGN KEY (preCourse) REFERENCES Courses(code)
      7  );
    Table created.
    SQL>
    SQL>
    SQL> drop table CourseResult;
    Table dropped.
    SQL> CREATE TABLE CourseResult (
      2  student NUMBER(6),
      3  course VARCHAR2(15));
    Table created.
    SQL>
    SQL> CREATE OR REPLACE VIEW DemandOfCourses (student, course, situation) AS
      2  (SELECT student, course, 'REGISTERED' FROM Registered)
      3  UNION
      4  (SELECT student, course, 'WAITING' FROM WaitingFor);
    View created.
    SQL>
    SQL> INSERT INTO Courses VALUES ('EDA242', 'MATHEMATICS 1', 5);
    1 row created.
    SQL>
    SQL> INSERT INTO LimitedCourse VALUES ('EDA242', 15);
    1 row created.
    SQL>
    SQL>
    SQL> CREATE OR REPLACE TRIGGER DemandOfCourses_T1_II
      2  INSTEAD OF INSERT ON DemandOfCourses
      3  REFERENCING NEW AS NEW OLD AS OLD
      4  FOR EACH ROW
      5  DECLARE
      6   cpc NUMBER;
      7   currentNum NUMBER;
      8   stud1 NUMBER;
      9   stud2 NUMBER;
    10   prec NUMBER;
    11   exc1 EXCEPTION;
    12   exc2 EXCEPTION;
    13 
    14  BEGIN
    15 
    16  SELECT capacity
    17  INTO cpc
    18  FROM LimitedCourse
    19  WHERE course = :NEW.course;
    20  dbms_output.put_line('cpc '||cpc);
    21 
    22  IF cpc IS NULL THEN
    23   cpc := 1000;
    24  END IF;
    25 
    26 
    27  SELECT COUNT(*)
    28  INTO currentNum
    29  FROM Registered
    30  WHERE course = :NEW.course;
    31  dbms_output.put_line('currentNum '||currentNum);
    32 
    33  SELECT COUNT(*)
    34  INTO stud1
    35  FROM Registered
    36  WHERE student = :NEW.student
    37  AND course = :NEW.course;
    38  dbms_output.put_line('stud1 '||stud1);
    39 
    40  SELECT COUNT(*)
    41  INTO stud2
    42  FROM WaitingFor
    43  WHERE student = :NEW.student
    44  AND course = :NEW.course;
    45  dbms_output.put_line('stud2 '||stud2);
    46 
    47 
    48  SELECT COUNT(*)
    49  INTO prec
    50  FROM HasPrereq hp
    51  WHERE hp.course = :NEW.course
    52  AND hp.preCourse NOT IN (SELECT course FROM CourseResult WHERE student = :NEW.student);
    53  dbms_output.put_line('prec '||prec);
    54 
    55 
    56  IF (prec = 0) THEN
    57   IF (stud1 = 0) AND (stud2 = 0) THEN
    58    IF (currentNum = cpc) THEN
    59     dbms_output.put_line('IF_1');
    60     INSERT INTO WaitingFor
    61     VALUES (:NEW.student, :NEW.course, SYSTIMESTAMP);
    62    ELSE
    63     dbms_output.put_line('ELSE_1');
    64     INSERT INTO Registered
    65     VALUES (:NEW.student, :NEW.course);
    66    END IF;
    67   ELSE
    68    dbms_output.put_line('ELSE_2');
    69    RAISE exc1;
    70   END IF;
    71  ELSE
    72   dbms_output.put_line('ELSE_3');
    73   RAISE exc2;
    74  END IF;
    75 
    76  EXCEPTION
    77  WHEN exc1 THEN RAISE_APPLICATION_ERROR (-20002, 'Already registered for this course.');
    78  WHEN exc2 THEN RAISE_APPLICATION_ERROR (-20003, 'First the prerequesite course(s) must be taken
    79  WHEN NO_DATA_FOUND THEN dbms_output.put_line('NO_DATA_FOUND');
    80  END;
    81  /
    Trigger created.
    SQL>
    SQL> INSERT INTO DemandOfCourses VALUES (100005, 'EDA242', 'REGISTERED');
    cpc 15
    currentNum 0 --here all count are 0, also you insert...
    stud1 0
    stud2 0
    prec 0
    ELSE_1
    1 row created.
    SQL> INSERT INTO DemandOfCourses VALUES (100005, 'EDA242', 'REGISTERED');
    INSERT INTO DemandOfCourses VALUES (100005, 'EDA242', 'REGISTERED')
    ERROR at line 1:
    ORA-20002: Already registered for this course. --For the second time, you have your excetion...
    ORA-06512: at "SCOTT.DEMANDOFCOURSES_T1_II", line 73
    ORA-04088: error during execution of trigger 'SCOTT.DEMANDOFCOURSES_T1_II'
    SQL> Nicolas.

Maybe you are looking for

  • Connected macbook pro to rca tv and not working

    i have a late 2011 macbook pro. i've tried connecting it up to my old tv by.. minidisplay port -> vga -> tv/pc converter to RCA. i get a signal on my macbook pro picking up my tv but on the tv i get tons of moving/flickering lines sometimes with a sl

  • Pleas a step by step instruction for downloading photos and videos from verizon palm pre to pc. Thank you.

    Post relates to: Pre 2 p102eww (Verizon)

  • PRE9 Project Settings questions

    I just got PRE9 and I am working on my first video.  The question I have is about project settings and resolutions, etc.  I want to output the video to both DVD and to a file that can be copied to a USB thumb drive and plugged into my l 55in HDTV for

  • Bluetooth Headset Compatability

    I have a Motorola HT820 bluetooth headset and a bluetooth adapter for my iPod. This works great together. Can these headphones be used with my iPhone. I have paired the devices but I cannot get music through the phones.

  • Map Title/Copyright font size settings

    Does anyone know how to set the font size/color etc for the map title. i.e. This can be set in the client side by: MapViewer.setMapTitle("my title"); Then theres the MapViewer config, e.g: <global_map_config> <note text="local" font="sans serif" posi