Wait Step, Exception Handling, Alerts

Hi Everybody,
             I am implementing a BPM scenario. I have a few questions:
1) The wait step i am using in BPm, allows me the min wait time as 1 min, can't I have lesser wait time then that. Lets say 30 secs.
2) Under what conditions should I use exception handling and when should i use alerts.
Regards,
Ashish

Dear Ashish,
1) In BPM  the 60 secs is the minimum  possible  one till now.
2) Exceptions :
   Assume when the condition happend to  divide  by  ZERO we have to go for exceptions it to control the break of the conditions and getting the system into HANG.
3) Alerts :
  We  use Alerts  When any error  message happen to  flow , Particularly  for Support  team information, If  they  check the mail or Alert  messages they  will come to know  where or exactly  which interface  is throwing or flowing  the error  messages.
Regards
Agasthuri Doss

Similar Messages

  • Integration Process exception handling & alerts, Java

    Hello,
    I would like to enhance my basic scenarios fool proof and with as much Java as possible.
    I have set up several asynchronous and synchronous File to SOAP transfers between systems A and B
    using PI70 including my own Java mapping classes and PI's AF_Modules beans. They work just fine.
    I have not designed my own Integration Processes yet, so execution is based on channel settings and availability timing.
    I have learned this aproach may be exposed to general faults resulting manual monitoring and repairing.
    For example server problems at receiver side can result data losses as sender channel just keeps removing source
    files like normally, as the process would be better to just stop right there and alert or something.
    My question is, is the "Enterprise services Builders" Integration Process & Graphical definition screen the one and only tool to 
    customize whole process exception handling and alerts in PI, and Java is not an option?
    Appreciate your advice on this.
    Kind regards m

    Hi m,
    Strange Name
    >>I have learned this aproach may be exposed to general faults resulting manual monitoring and repairing. For example server problems at receiver side can result data losses as sender channel just keeps removing source  files like normally, as the process would be better to just stop right there and alert or something.
    If you are looking to handle this particular scenario, then we have the alert mechanism and CCMS monitoring. There you will come to know whether the end system down or not.
    Also in addition to this you can write your own java (in message mapping, as modules, java mapping) /abap code (as abap mapping, user exit in standard functions etc) for providing more details in error scenarios. But you need to validate whether the maintenance/development cost for the code is justified in your scenarios
    Regards
    Suraj

  • Exception Handling in Message Mapping and Alert

    Hello,
    1. Pls let me know the concept of Exception Handling and Alerts.
    2. Pls provide some blogs for Exception Handling in Message Mapping.
    3.What are Alerts and how it help us in XI. Pls provide some blogs for Alert
    4.How are Alerts and Exception Handling can be related say for some scenario
    Regards

    Hi,
    Plz check out these blogs of Sravya on Error Handling:
    /people/sravya.talanki2/blog/2006/11/22/error-handling-framework-xiout-of-the-box-episode-1
    /people/sravya.talanki2/blog/2006/11/23/error-handling-framework-xiout-of-the-box-episode-2
    Also check this SAP Presentation:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9418d690-0201-0010-85bb-e9b2c1af895b
    /people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-mapping
    Error Handling :
    http://help.sap.com/saphelp_nw04/helpdata/en/56/b46c3c8bb3d73ee10000000a114084/frameset.htm
    Alerts:
    /people/michal.krawczyk2/blog/2005/09/09/xi-alerts--troubleshooting-guide
    /people/michal.krawczyk2/blog/2005/09/09/xi-alerts--step-by-step
    http://help.sap.com/saphelp_nw04/helpdata/en/56/d5b54020c6792ae10000000a155106/content.htm
    BPM:
    /people/arpit.seth/blog/2005/06/27/rfc-scenario-using-bpm--starter-kit
    Working with acknowledgements
    regards

  • Step repeated in Exception branch requires exception handler, why?

    I have a BPM Integration process with a sync send step calling a RFC. Any system errors and application errors are handled by an exception branch where I send an alert as then re-do the send step (so that it will fail but allow me to restart from that point after fixing the issue). The problem I am having is that in this send step, since it is mandatory to have an exception handler for application errors (defined fault message RFC.Exception), what do I enter for exception handler in this send step which is itself in an exception branch? I do not want to handle the exception this second time since I want this step to fail and process stops here to be able to restart manually later.

    Hi,
    I am not sure, how you will restart the step manually? Because once there is an error in the sync send, the message will turn to "Cancelled" status. You cannot restart this message.
    Now, for the second send step in the exception block you will not be able to choose the same exception block in the exception handler field. But for some reason if this send also fails then you cannot restart the process manually - same reason i mentioned above. It will fail as you intended it to do so.
    Regards,
    Balaji.M

  • BPM Exception Handling control step

    Hi,
    Does anybody have any idea, whats the variable we need to pass in the control step of exception handling  in BPM? and how to map the error message back to the RFC Response.
    I had Transformation step, in that mapping is also there.
    Is there any ideas??.
    Thanks,
    Raj.

    Hi,
    The requirement was to send the exception that occured to a target (say file).
    <i>insert a block for the exception</i>
    You cannot place an exception step without a block right... thats what i mean by the above statement.
    Now, just after the exception has taken place, if i put a transformation step, and a send step, you will be taking care of sending the exception message to the target.
    <i>how to build the exception message ? It should map from what?</i>
    You could build a data type for the exception.
    In the mapping, you could map it to constants. For ex:
    if you build your DT as
    <excep>
    <code/>
    <desc/>
    </excep>
    You could map the description to a constant string "timeout".
    After this, the send step will send the message to the file, through the abstract interface that you create.
    Regards,
    Smitha.

  • ABAP Client Proxy Exception Handling and Alerting

    Hi,
    When we call an outbound ABAP Proxy we have a try/catch section for handling system exception. In what situation the exception is thrown. Also since we are catching that exception, how alerting can be done via CCMS or Alert Framework.
    Regards,
    Sudharshan

    Hi Sudharsan,
    First configure CCMS in XI System:-
    /people/sap.user72/blog/2005/11/24/xi-configuring-ccms-monitoring-for-xi-part-i
    For Monitoring in the CCMS:-
    http://help.sap.com/saphelp_nw04/helpdata/en/4d/6272376d3bfa2be10000009b38f8cf/frameset.htm
    Go thro' this link for configuration scenario:-
    /people/aravindh.prasanna/blog/2005/12/23/configuring-scenario-specific-e-mail-alerts-in-xi-ccms-part--1
    I hope this helps.
    Regards.
    Praveen

  • Exception Handling Problem In BPM

    All
    I am facing an exception handling problem I am using BPM and , I have caught exception in the transformation step but when there is any data problem in that mapping(mentioned in the transformation)
    it is not throwing the exception . is there any option to collect these type of system exception in  the bpm and give a alert thru mail
    is there any way to collect these type of exception happened in the BPE and raise alert thru generic alert
    Thanks
    Jayaraman

    Hi Jayaraman,
        When you say there is any data problem, does that fail the message mapping that you have defined?
    If the message mapping used in the tranformation fails, it should raise an exception in the BPM.
    Did you test the message mapping using the payload and see if it really fails or not?
    Regards,
    Ravi Kanth Talagana

  • Exception Handling in BPM

    Hello,
    1. I have created a block step B
    2. I have created a ReceiverDetermination and send step(S) inside Block B  .
    3. I have created ExceptionHandler EH.
    4. I have assigned this ExceptionHandler EH  in the send Block Exceptions-SystemError.
    5. In ExceptionHandler EH ,i have created a controlstep for throwing Alert .
    Problem i am facing now is when an error occurs in send step it is not throwing Exception.
    Did i missed something.
    Thanks in Advance for responses
    Rajesh

    Hello All,
                    Thanks for your replies,but in my case i have defined the ExceptionHandler and assigned the ExceptionName (EH) to the send step Exceptions-SystemError property ,and when i run the BPM scenario at the send error occured and it has to go to ExceptionHandler block which is not happening and i am seeing error at block as NoAgent error and i searched the forum for this error category and
    deleted all the BPM Instances and activated the Integration process but in vain ,
    I tried to throw exception intentionally and which worked well'
    Overall when an error occured at send it is not going to ExceptionHandling branch,What might be wrong
    I think send asynchronous step is capable of raising systemErrors right???
    Million dollars for the replies
    Waiting for responses
    -Rajesh

  • BPM Exception Handling

    I am trying to test my Deadline and Exception handling.But it is not at all working. I will explain what I have done, please guide me where I am going wrong.
    1) Block Step. Properties --- Exception == ERROR1
    2)Switch Step . Success Branch . Send Step. with a Transport Response. And I am sending to the Mail adapter. And in directory I have provided the WRONG URL FOR THIS Mail.
          Otherwsie Branch. Send step, sending to a File.
    3)Dead Lock Branch : Having a Control Step.
                  Properties
                   Action : Throw Exception
                   Exception: ERROR1
    4) Exception Branch.
               Properties
                    Exception Handler : ERROR1
          Send Step : Send a Message to  a File (
    Result
    I am Seeing a Clock in my SXMB_MONI OUTBOUND_Status column, because I am expecting a TRANSPOT Response, and this going to never happen, so I thought the Deadline monitor will wakeup after 1 minute interval and my Exception branch has to Trigger, but it has never triggered my Deadline branch aswell as my Exception Branch.
    WE are in XI SP 12.  We dont have CCMS installed yet, even ALERT management is not installed.
    Please guide me.
    Thanks.

    Hi Anand,
    I looked into the Transaction SWI2_DEAD and I dont see any listings there.
    I am executing 1 Minute deadline Monitoring and from here firing an exception Branch, for my Asynchronous Scenario.
    So definitely after a minute , the DeadLine Branch should have been fired. But it didnot take place.
    In the mean time I have located an OSS notes OSS note 829921 And I am awaiting my Basis team to apply this note.
    symptom
    If the execution of an asynchronous method ends with a "system error" or "application error", the work item is not set to the 'ERROR' status.
    Other terms
    Reason and Prerequisites
    This problem is caused by a program error.
    Solution
    Implement the correction instructions.
    Note the following manual changes that must be implemented BEFORE you use SNOTE to implement the corrections:
    1. Make sure that the SET_EXECUTION_INTERRUPTED method of the CL_SWF_RUN_RESULT class has the following parameters:
    a) IM_CODE, Importing, Optional, Type SWO_RETURN, default Value 0000
    b) IM_ERRORTYPE, Importing, Optional, Type SWO_ERRTYP, Default Value 0
    Note the following manual changes, which you must carry out AFTER you have implemented the corrections:
    1. The M_EXECUTION_INTERRUPTED attribute type of the CL_SWF_RUN_RESULT class must be changed to EXECUTION_INTERRUPTED.

  • An exception handler is obligatory for synchronous RFC communication

    I am getting the error "An exception handler is obligatory for synchronous RFC communication" when I try to activate an Integration Process. Under a synchronous Send step, under Exceptions, I have System Error and the RFC.Exception Application Error to be handled. For both I have given the same Exception handler block. Is this not allowed? Why am I not able to go to same Exception handler block in case of both System Error as well as Application Error?
    Thanks

    you are right, it was erroring out due to the next step. Now if there is system error or exception, it will go to the exception branch. Here I need to have the ability to restart the process from this point after being alerted and having fixed the issue. So I am thinking of doing the send step again in the exception branch. But since the application error initially will exist soon after the alert is issued, this step will complete as I cannot handle application error a second time (this is where it was giving that error that exception handler was mandatory).
    Is there a way in which I can stop/fail the process after the exception branch gives the alert so that I can restart the failed branch again?

  • Transformation step exception

    Hi,
    I want to route message to one recieve if there is any error in transformation step.
    If transformation is success then it must be routed another reciever.How can i achieve this.
    Tried with exceptions but transfomration step handles only system errors and cancels message processing.
    Thanks
    --Pradeep

    Hi,
    Exception Handling can be used around Send Steps and Transformation Steps.
    Use of Exception Handling is a very essential step inside your BPM and the best thing to do would be to wrap each of your Send / Transformation inside a Exception Handling block.
    Michal's blogs : Very useful block
    /people/michal.krawczyk2/blog/2005/09/09/xi-alerts--step-by-step /people/michal.krawczyk2/blog/2005/09/09/xi-alerts--troubleshooting-guide
    You can use Moorthy's blog on Reocnilation as well as trigger alerts.
    /people/krishna.moorthyp/blog/2006/04/08/reconciliation-of-messages-in-bpm
    Please reward points if it helps
    Thanks
    Vikranth
    Edited by: Khimavath Vikranth on Jun 12, 2008 10:09 AM

  • PL/SQL 101 : Exception Handling

    Frequently I see questions and issues around the use of Exception/Error Handling in PL/SQL.  More often than not the issue comes from the questioners misunderstanding about how PL/SQL is constructed and executed, so I thought I'd write a small article covering the key concepts to give a clear picture of how it all hangs together. (Note: the examples are just showing examples of the exception handling structure, and should not be taken as truly valid code for ways of handling things)
    Exception Handling
    Contents
    1. Understanding Execution Blocks (part 1)
    2. Execution of the Execution Block
    3. Exceptions
    4. Understanding Execution Blocks (part 2)
    5. How to continue exection of statements after an exception
    6. User defined exceptions
    7. Line number of exception
    8. Exceptions within code within the exception block
    1. Understanding Execution Blocks (part 1)
    The first thing that one needs to understand is almost taking us back to the basics of PL/SQL... how a PL/SQL execution block is constructed.
    Essentially an execution block is made of 3 sections...
    +---------------------------+
    |    Declaration Section    |
    +---------------------------+
    |    Statements  Section    |
    +---------------------------+
    |     Exception Section     |
    +---------------------------+
    The Declaration section is the part defined between the PROCEDURE/FUNCTION header or the DECLARE keyword (for anonymous blocks) and the BEGIN keyword.  (Optional section)
    The Statements section is where your code goes and lies between the BEGIN keyword and the EXCEPTION keyword (or END keyword if there is no EXCEPTION section).  (Mandatory section)
    The Exception section is where any exception handling goes and lies between the EXCEPTION keyword at the END keyword. (Optional section)
    Example of an anonymous block...
    DECLARE
      .. declarative statements go here ..
    BEGIN
      .. code statements go here ..
    EXCEPTION
      .. exception handlers go here ..
    END;
    Example of a procedure/function block...
    [CREATE OR REPLACE] (PROCEDURE|FUNCTION) <proc or fn name> [(<parameters>)] [RETURN <datatype>] (IS|AS)
      .. declarative statements go here ..
    BEGIN
      .. code statements go here ..
    EXCEPTION
      .. exception handlers go here ..
    END;
    (Note: The same can also be done for packages, but let's keep it simple)
    2. Execution of the Execution Block
    This may seem a simple concept, but it's surprising how many people have issues showing they haven't grasped it.  When an Execution block is entered, the declaration section is processed, creating a scope of variables, types , cursors, etc. to be visible to the execution block and then execution enters into the Statements section.  Each statment in the statements section is executed in turn and when the execution completes the last statment the execution block is exited back to whatever called it.
    3. Exceptions
    Exceptions generally happen during the execution of statements in the Statements section.  When an exception happens the execution of statements jumps immediately into the exception section.  In this section we can specify what exceptions we wish to 'capture' or 'trap' and do one of the two following things...
    (Note: The exception section still has access to all the declared items in the declaration section)
    3.i) Handle the exception
    We do this when we recognise what the exception is (most likely it's something we expect to happen) and we have a means of dealing with it so that our application can continue on.
    Example...
    (without the exception handler the exception is passed back to the calling code, in this case SQL*Plus)
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    v_name VARCHAR2(20);
      3  begin
      4    select ename
      5    into   v_name
      6    from   emp
      7    where  empno = &empno;
      8    dbms_output.put_line(v_name);
      9* end;
    SQL> /
    Enter value for empno: 123
    old   7:   where  empno = &empno;
    new   7:   where  empno = 123;
    declare
    ERROR at line 1:
    ORA-01403: no data found
    ORA-06512: at line 4
    (with an exception handler, we capture the exception, handle it how we want to, and the calling code is happy that there is no error for it to report)
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    v_name VARCHAR2(20);
      3  begin
      4    select ename
      5    into   v_name
      6    from   emp
      7    where  empno = &empno;
      8    dbms_output.put_line(v_name);
      9  exception
    10    when no_data_found then
    11      dbms_output.put_line('There is no employee with this employee number.');
    12* end;
    SQL> /
    Enter value for empno: 123
    old   7:   where  empno = &empno;
    new   7:   where  empno = 123;
    There is no employee with this employee number.
    PL/SQL procedure successfully completed.
    3.ii) Raise the exception
    We do this when:-
    a) we recognise the exception, handle it but still want to let the calling code know that it happened
    b) we recognise the exception, wish to log it happened and then let the calling code deal with it
    c) we don't recognise the exception and we want the calling code to deal with it
    Example of b)
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    v_name VARCHAR2(20);
      3    v_empno NUMBER := &empno;
      4  begin
      5    select ename
      6    into   v_name
      7    from   emp
      8    where  empno = v_empno;
      9    dbms_output.put_line(v_name);
    10  EXCEPTION
    11    WHEN no_data_found THEN
    12      INSERT INTO sql_errors (txt)
    13      VALUES ('Search for '||v_empno||' failed.');
    14      COMMIT;
    15      RAISE;
    16* end;
    SQL> /
    Enter value for empno: 123
    old   3:   v_empno NUMBER := &empno;
    new   3:   v_empno NUMBER := 123;
    declare
    ERROR at line 1:
    ORA-01403: no data found
    ORA-06512: at line 15
    SQL> select * from sql_errors;
    TXT
    Search for 123 failed.
    SQL>
    Example of c)
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    v_name VARCHAR2(20);
      3    v_empno NUMBER := &empno;
      4  begin
      5    select ename
      6    into   v_name
      7    from   emp
      8    where  empno = v_empno;
      9    dbms_output.put_line(v_name);
    10  EXCEPTION
    11    WHEN no_data_found THEN
    12      INSERT INTO sql_errors (txt)
    13      VALUES ('Search for '||v_empno||' failed.');
    14      COMMIT;
    15      RAISE;
    16    WHEN others THEN
    17      RAISE;
    18* end;
    SQL> /
    Enter value for empno: 'ABC'
    old   3:   v_empno NUMBER := &empno;
    new   3:   v_empno NUMBER := 'ABC';
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at line 3
    SQL> select * from sql_errors;
    TXT
    Search for 123 failed.
    SQL>
    As you can see from the sql_errors log table, no log was written so the WHEN others exception was the exception that raised the error to the calling code (SQL*Plus)
    4. Understanding Execution Blocks (part 2)
    Ok, so now we understand the very basics of an execution block and what happens when an exception happens.  Let's take it a step further...
    Execution blocks are not just a single simple block in most cases.  Often, during our statements section we have a need to call some reusable code and we do that by calling a procedure or function.  Effectively this nests the procedure or function's code as another execution block within the current statement section so, in terms of execution, we end up with something like...
    +---------------------------------+
    |    Declaration Section          |
    +---------------------------------+
    |    Statements  Section          |
    |            .                    |
    |  +---------------------------+  |
    |  |    Declaration Section    |  |
    |  +---------------------------+  |
    |  |    Statements  Section    |  |
    |  +---------------------------+  |
    |  |     Exception Section     |  |
    |  +---------------------------+  |
    |            .                    |
    +---------------------------------+
    |     Exception Section           |
    +---------------------------------+
    Example... (Note: log_trace just writes some text to a table for tracing)
    SQL> create or replace procedure a as
      2    v_dummy NUMBER := log_trace('Procedure A''s Declaration Section');
      3  begin
      4    v_dummy := log_trace('Procedure A''s Statement Section');
      5    v_dummy := 1/0; -- cause an exception
      6  exception
      7    when others then
      8      v_dummy := log_trace('Procedure A''s Exception Section');
      9      raise;
    10  end;
    11  /
    Procedure created.
    SQL> create or replace procedure b as
      2    v_dummy NUMBER := log_trace('Procedure B''s Declaration Section');
      3  begin
      4    v_dummy := log_trace('Procedure B''s Statement Section');
      5    a; -- HERE the execution passes to the declare/statement/exception sections of A
      6  exception
      7    when others then
      8      v_dummy := log_trace('Procedure B''s Exception Section');
      9      raise;
    10  end;
    11  /
    Procedure created.
    SQL> exec b;
    BEGIN b; END;
    ERROR at line 1:
    ORA-01476: divisor is equal to zero
    ORA-06512: at "SCOTT.B", line 9
    ORA-06512: at line 1
    SQL> select * from code_trace;
    TXT
    Procedure B's Declaration Section
    Procedure B's Statement Section
    Procedure A's Declaration Section
    Procedure A's Statement Section
    Procedure A's Exception Section
    Procedure B's Exception Section
    6 rows selected.
    SQL>
    Likewise, execution blocks can be nested deeper and deeper.
    5. How to continue exection of statements after an exception
    One of the common questions asked is how to return execution to the statement after the one that created the exception and continue on.
    Well, firstly, you can only do this for statements you expect to raise an exception, such as when you want to check if there is no data found in a query.
    If you consider what's been shown above you could put any statement you expect to cause an exception inside it's own procedure or function with it's own exception section to handle the exception without raising it back to the calling code.  However, the nature of procedures and functions is really to provide a means of re-using code, so if it's a statement you only use once it seems a little silly to go creating individual procedures for these.
    Instead, you nest execution blocks directly, to give the same result as shown in the diagram at the start of part 4 of this article.
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure b (p_empno IN VARCHAR2) as
      2    v_dummy NUMBER := log_trace('Procedure B''s Declaration Section');
      3  begin
      4    v_dummy := log_trace('Procedure B''s Statement Section');
      5    -- Here we start another execution block nested in the first one...
      6    declare
      7      v_dummy NUMBER := log_trace('Nested Block Declaration Section');
      8    begin
      9      v_dummy := log_trace('Nested Block Statement Section');
    10      select empno
    11        into   v_dummy
    12        from   emp
    13       where  empno = p_empno; -- Note: the parameters and variables from
                                         parent execution block are available to use!
    14    exception
    15      when no_data_found then
    16        -- This is an exception we can handle so we don't raise it
    17        v_dummy := log_trace('No employee was found');
    18        v_dummy := log_trace('Nested Block Exception Section - Exception Handled');
    19      when others then
    20        -- Other exceptions we can't handle so we raise them
    21        v_dummy := log_trace('Nested Block Exception Section - Exception Raised');
    22        raise;
    23    end;
    24    -- ...Here endeth the nested execution block
    25    -- As the nested block handled it's exception we come back to here...
    26    v_dummy := log_trace('Procedure B''s Statement Section Continued');
    27  exception
    28    when others then
    29      -- We'll only get to here if an unhandled exception was raised
    30      -- either in the nested block or in procedure b's statement section
    31      v_dummy := log_trace('Procedure B''s Exception Section');
    32      raise;
    33* end;
    SQL> /
    Procedure created.
    SQL> exec b(123);
    PL/SQL procedure successfully completed.
    SQL> select * from code_trace;
    TXT
    Procedure B's Declaration Section
    Procedure B's Statement Section
    Nested Block Declaration Section
    Nested Block Statement Section
    No employee was found
    Nested Block Exception Section - Exception Handled
    Procedure B's Statement Section Continued
    7 rows selected.
    SQL> truncate table code_trace;
    Table truncated.
    SQL> exec b('ABC');
    BEGIN b('ABC'); END;
    ERROR at line 1:
    ORA-01722: invalid number
    ORA-06512: at "SCOTT.B", line 32
    ORA-06512: at line 1
    SQL> select * from code_trace;
    TXT
    Procedure B's Declaration Section
    Procedure B's Statement Section
    Nested Block Declaration Section
    Nested Block Statement Section
    Nested Block Exception Section - Exception Raised
    Procedure B's Exception Section
    6 rows selected.
    SQL>
    You can see from this that, very simply, the code that we expected may have an exception was able to either handle the exception and return to the outer execution block to continue execution, or if an unexpected exception occurred then it was able to be raised up to the outer exception section.
    6. User defined exceptions
    There are three sorts of 'User Defined' exceptions.  There are logical situations (e.g. business logic) where, for example, certain criteria are not met to complete a task, and there are existing Oracle errors that you wish to give a name to in order to capture them in the exception section.  The third is raising your own exception messages with our own exception numbers.  Let's look at the first one...
    Let's say I have tables which detail stock availablility and reorder levels...
    SQL> select * from reorder_level;
       ITEM_ID STOCK_LEVEL
             1          20
             2          20
             3          10
             4           2
             5           2
    SQL> select * from stock;
       ITEM_ID ITEM_DESC  STOCK_LEVEL
             1 Pencils             10
             2 Pens                 2
             3 Notepads            25
             4 Stapler              5
             5 Hole Punch           3
    SQL>
    Now, our Business has told the administrative clerk to check stock levels and re-order anything that is below the re-order level, but not to hold stock of more than 4 times the re-order level for any particular item.  As an IT department we've been asked to put together an application that will automatically produce the re-order documents upon the clerks request and, because our company is so tight-ar*ed about money, they don't want to waste any paper with incorrect printouts so we have to ensure the clerk can't order things they shouldn't.
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure re_order(p_item_id NUMBER, p_quantity NUMBER) is
      2    cursor cur_stock_reorder is
      3      select s.stock_level
      4            ,r.stock_level as reorder_level
      5            ,(r.stock_level*4) as reorder_limit
      6      from stock s join reorder_level r on (s.item_id = r.item_id)
      7      where s.item_id = p_item_id;
      8    --
      9    v_stock cur_stock_reorder%ROWTYPE;
    10  begin
    11    OPEN cur_stock_reorder;
    12    FETCH cur_stock_reorder INTO v_stock;
    13    IF cur_stock_reorder%NOTFOUND THEN
    14      RAISE no_data_found;
    15    END IF;
    16    CLOSE cur_stock_reorder;
    17    --
    18    IF v_stock.stock_level >= v_stock.reorder_level THEN
    19      -- Stock is not low enough to warrant an order
    20      DBMS_OUTPUT.PUT_LINE('Stock has not reached re-order level yet!');
    21    ELSE
    22      IF v_stock.stock_level + p_quantity > v_stock.reorder_limit THEN
    23        -- Required amount is over-ordering
    24        DBMS_OUTPUT.PUT_LINE('Quantity specified is too much.  Max for this item: '
                                     ||to_char(v_stock.reorder_limit-v_stock.stock_level));
    25      ELSE
    26        DBMS_OUTPUT.PUT_LINE('Order OK.  Printing Order...');
    27        -- Here goes our code to print the order
    28      END IF;
    29    END IF;
    30    --
    31  exception
    32    WHEN no_data_found THEN
    33      CLOSE cur_stock_reorder;
    34      DBMS_OUTPUT.PUT_LINE('Invalid Item ID.');
    35* end;
    SQL> /
    Procedure created.
    SQL> exec re_order(10,100);
    Invalid Item ID.
    PL/SQL procedure successfully completed.
    SQL> exec re_order(3,40);
    Stock has not reached re-order level yet!
    PL/SQL procedure successfully completed.
    SQL> exec re_order(1,100);
    Quantity specified is too much.  Max for this item: 70
    PL/SQL procedure successfully completed.
    SQL> exec re_order(2,50);
    Order OK.  Printing Order...
    PL/SQL procedure successfully completed.
    SQL>
    Ok, so that code works, but it's a bit messy with all those nested IF statements. Is there a cleaner way perhaps?  Wouldn't it be nice if we could set up our own exceptions...
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure re_order(p_item_id NUMBER, p_quantity NUMBER) is
      2    cursor cur_stock_reorder is
      3      select s.stock_level
      4            ,r.stock_level as reorder_level
      5            ,(r.stock_level*4) as reorder_limit
      6      from stock s join reorder_level r on (s.item_id = r.item_id)
      7      where s.item_id = p_item_id;
      8    --
      9    v_stock cur_stock_reorder%ROWTYPE;
    10    --
    11    -- Let's declare our own exceptions for business logic...
    12    exc_not_warranted EXCEPTION;
    13    exc_too_much      EXCEPTION;
    14  begin
    15    OPEN cur_stock_reorder;
    16    FETCH cur_stock_reorder INTO v_stock;
    17    IF cur_stock_reorder%NOTFOUND THEN
    18      RAISE no_data_found;
    19    END IF;
    20    CLOSE cur_stock_reorder;
    21    --
    22    IF v_stock.stock_level >= v_stock.reorder_level THEN
    23      -- Stock is not low enough to warrant an order
    24      RAISE exc_not_warranted;
    25    END IF;
    26    --
    27    IF v_stock.stock_level + p_quantity > v_stock.reorder_limit THEN
    28      -- Required amount is over-ordering
    29      RAISE exc_too_much;
    30    END IF;
    31    --
    32    DBMS_OUTPUT.PUT_LINE('Order OK.  Printing Order...');
    33    -- Here goes our code to print the order
    34    --
    35  exception
    36    WHEN no_data_found THEN
    37      CLOSE cur_stock_reorder;
    38      DBMS_OUTPUT.PUT_LINE('Invalid Item ID.');
    39    WHEN exc_not_warranted THEN
    40      DBMS_OUTPUT.PUT_LINE('Stock has not reached re-order level yet!');
    41    WHEN exc_too_much THEN
    42      DBMS_OUTPUT.PUT_LINE('Quantity specified is too much.  Max for this item: '
                                  ||to_char(v_stock.reorder_limit-v_stock.stock_level));
    43* end;
    SQL> /
    Procedure created.
    SQL> exec re_order(10,100);
    Invalid Item ID.
    PL/SQL procedure successfully completed.
    SQL> exec re_order(3,40);
    Stock has not reached re-order level yet!
    PL/SQL procedure successfully completed.
    SQL> exec re_order(1,100);
    Quantity specified is too much.  Max for this item: 70
    PL/SQL procedure successfully completed.
    SQL> exec re_order(2,50);
    Order OK.  Printing Order...
    PL/SQL procedure successfully completed.
    SQL>
    That's better.  And now we don't have to use all those nested IF statements and worry about it accidently getting to code that will print the order out as, once one of our user defined exceptions is raised, execution goes from the Statements section into the Exception section and all handling of errors is done in one place.
    Now for the second sort of user defined exception...
    A new requirement has come in from the Finance department who want to have details shown on the order that show a re-order 'indicator' based on the formula ((maximum allowed stock - current stock)/re-order quantity), so this needs calculating and passing to the report...
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure re_order(p_item_id NUMBER, p_quantity NUMBER) is
      2    cursor cur_stock_reorder is
      3      select s.stock_level
      4            ,r.stock_level as reorder_level
      5            ,(r.stock_level*4) as reorder_limit
      6            ,(((r.stock_level*4)-s.stock_level)/p_quantity) as finance_factor
      7      from stock s join reorder_level r on (s.item_id = r.item_id)
      8      where s.item_id = p_item_id;
      9    --
    10    v_stock cur_stock_reorder%ROWTYPE;
    11    --
    12    -- Let's declare our own exceptions for business logic...
    13    exc_not_warranted EXCEPTION;
    14    exc_too_much      EXCEPTION;
    15  begin
    16    OPEN cur_stock_reorder;
    17    FETCH cur_stock_reorder INTO v_stock;
    18    IF cur_stock_reorder%NOTFOUND THEN
    19      RAISE no_data_found;
    20    END IF;
    21    CLOSE cur_stock_reorder;
    22    --
    23    IF v_stock.stock_level >= v_stock.reorder_level THEN
    24      -- Stock is not low enough to warrant an order
    25      RAISE exc_not_warranted;
    26    END IF;
    27    --
    28    IF v_stock.stock_level + p_quantity > v_stock.reorder_limit THEN
    29      -- Required amount is over-ordering
    30      RAISE exc_too_much;
    31    END IF;
    32    --
    33    DBMS_OUTPUT.PUT_LINE('Order OK.  Printing Order...');
    34    -- Here goes our code to print the order, passing the finance_factor
    35    --
    36  exception
    37    WHEN no_data_found THEN
    38      CLOSE cur_stock_reorder;
    39      DBMS_OUTPUT.PUT_LINE('Invalid Item ID.');
    40    WHEN exc_not_warranted THEN
    41      DBMS_OUTPUT.PUT_LINE('Stock has not reached re-order level yet!');
    42    WHEN exc_too_much THEN
    43      DBMS_OUTPUT.PUT_LINE('Quantity specified is too much.  Max for this item: '
                                  ||to_char(v_stock.reorder_limit-v_stock.stock_level));
    44* end;
    SQL> /
    Procedure created.
    SQL> exec re_order(2,40);
    Order OK.  Printing Order...
    PL/SQL procedure successfully completed.
    SQL> exec re_order(2,0);
    BEGIN re_order(2,0); END;
    ERROR at line 1:
    ORA-01476: divisor is equal to zero
    ORA-06512: at "SCOTT.RE_ORDER", line 17
    ORA-06512: at line 1
    SQL>
    Hmm, there's a problem if the person specifies a re-order quantity of zero.  It raises an unhandled exception.
    Well, we could put a condition/check into our code to make sure the parameter is not zero, but again we would be wrapping our code in an IF statement and not dealing with the exception in the exception handler.
    We could do as we did before and just include a simple IF statement to check the value and raise our own user defined exception but, in this instance the error is standard Oracle error (ORA-01476) so we should be able to capture it inside the exception handler anyway... however...
    EXCEPTION
      WHEN ORA-01476 THEN
    ... is not valid.  What we need is to give this Oracle error a name.
    This is done by declaring a user defined exception as we did before and then associating that name with the error number using the PRAGMA EXCEPTION_INIT statement in the declaration section.
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure re_order(p_item_id NUMBER, p_quantity NUMBER) is
      2    cursor cur_stock_reorder is
      3      select s.stock_level
      4            ,r.stock_level as reorder_level
      5            ,(r.stock_level*4) as reorder_limit
      6            ,(((r.stock_level*4)-s.stock_level)/p_quantity) as finance_factor
      7      from stock s join reorder_level r on (s.item_id = r.item_id)
      8      where s.item_id = p_item_id;
      9    --
    10    v_stock cur_stock_reorder%ROWTYPE;
    11    --
    12    -- Let's declare our own exceptions for business logic...
    13    exc_not_warranted EXCEPTION;
    14    exc_too_much      EXCEPTION;
    15    --
    16    exc_zero_quantity EXCEPTION;
    17    PRAGMA EXCEPTION_INIT(exc_zero_quantity, -1476);
    18  begin
    19    OPEN cur_stock_reorder;
    20    FETCH cur_stock_reorder INTO v_stock;
    21    IF cur_stock_reorder%NOTFOUND THEN
    22      RAISE no_data_found;
    23    END IF;
    24    CLOSE cur_stock_reorder;
    25    --
    26    IF v_stock.stock_level >= v_stock.reorder_level THEN
    27      -- Stock is not low enough to warrant an order
    28      RAISE exc_not_warranted;
    29    END IF;
    30    --
    31    IF v_stock.stock_level + p_quantity > v_stock.reorder_limit THEN
    32      -- Required amount is over-ordering
    33      RAISE exc_too_much;
    34    END IF;
    35    --
    36    DBMS_OUTPUT.PUT_LINE('Order OK.  Printing Order...');
    37    -- Here goes our code to print the order, passing the finance_factor
    38    --
    39  exception
    40    WHEN exc_zero_quantity THEN
    41      DBMS_OUTPUT.PUT_LINE('Quantity of 0 (zero) is invalid.');
    42    WHEN no_data_found THEN
    43      CLOSE cur_stock_reorder;
    44      DBMS_OUTPUT.PUT_LINE('Invalid Item ID.');
    45    WHEN exc_not_warranted THEN
    46      DBMS_OUTPUT.PUT_LINE('Stock has not reached re-order level yet!');
    47    WHEN exc_too_much THEN
    48      DBMS_OUTPUT.PUT_LINE('Quantity specified is too much.  Max for this item: '
                                  ||to_char(v_stock.reorder_limit-v_stock.stock_level));
    49* end;
    SQL> /
    Procedure created.
    SQL> exec re_order(2,0);
    Quantity of 0 (zero) is invalid.
    PL/SQL procedure successfully completed.
    SQL>
    Lastly, let's look at raising our own exceptions with our own exception numbers...
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure re_order(p_item_id NUMBER, p_quantity NUMBER) is
      2    cursor cur_stock_reorder is
      3      select s.stock_level
      4            ,r.stock_level as reorder_level
      5            ,(r.stock_level*4) as reorder_limit
      6            ,(((r.stock_level*4)-s.stock_level)/p_quantity) as finance_factor
      7      from stock s join reorder_level r on (s.item_id = r.item_id)
      8      where s.item_id = p_item_id;
      9    --
    10    v_stock cur_stock_reorder%ROWTYPE;
    11    --
    12    exc_zero_quantity EXCEPTION;
    13    PRAGMA EXCEPTION_INIT(exc_zero_quantity, -1476);
    14  begin
    15    OPEN cur_stock_reorder;
    16    FETCH cur_stock_reorder INTO v_stock;
    17    IF cur_stock_reorder%NOTFOUND THEN
    18      RAISE no_data_found;
    19    END IF;
    20    CLOSE cur_stock_reorder;
    21    --
    22    IF v_stock.stock_level >= v_stock.reorder_level THEN
    23      -- Stock is not low enough to warrant an order
    24      [b]RAISE_APPLICATION_ERROR(-20000, 'Stock has not reached re-order level yet!');[/b]
    25    END IF;
    26    --
    27    IF v_stock.stock_level + p_quantity > v_stock.reorder_limit THEN
    28      -- Required amount is over-ordering
    29     

    its nice article, have put up this one the blog
    site,Nah, I don't have time to blog, but if one of the other Ace's/Experts wants to copy it to a blog with reference back to here (and all due credit given ;)) then that's fine by me.
    I'd go for a book like "Selected articles by OTN members" or something. Does anybody have a list of links of all those mentioned articles?Just these ones I've bookmarked...
    Introduction to regular expressions ... by CD
    When your query takes too long ... by Rob van Wijk
    How to pipeline a function with a dynamic number of columns? by ascheffer
    PL/SQL 101 : Exception Handling by BluShadow

  • BPM wait step : RWB"To Be Delivered status": SXMB_MONI"Message being sent"

    Hi All,
    I have a BPM interface running fine since 1 year.
    In this BPM I have wait step for 5 minutes.
    But yesterday message  is stopped on wait and not proceeding ahead.
    I checked XML is good as per mapping. and in runtime wirk bench message is still in "To Be Delivered status"
    and in SXMB_MONI message column Outbound Status still showing "Message being sent" even after 12 hours.(wait is only 5 minutes). And below is the trace of last message.
    Please guide how to handle or restart this message. in SMQ1 & SMQ2 there are no queues showing:
      <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Inbound Message
      -->
    - <SAP:Trace xmlns:SAP="http://sap.com/xi/XI/Message/30">
      <Trace level="1" type="T">--start determination of sender interface action</Trace>
      <Trace level="1" type="T">select interface Request_SI</Trace>
      <Trace level="1" type="T">select interface namespace https://www.XXXXX.com/YYYY</Trace>
      <Trace level="1" type="T">--start determination of receiver interface action</Trace>
      <Trace level="1" type="T">Loop 0000000001</Trace>
      <Trace level="1" type="T">select interface Request_SI</Trace>
      <Trace level="1" type="T">select interface namespace https://www.XXXXX.com/YYYY</Trace>
      <Trace level="1" type="T">--start determination of sender interface action</Trace>
      <Trace level="1" type="T">Hence set action to DEL</Trace>
      </SAP:Trace>
    Regards

    Solved, few BASIS jobs were inactive in transaction code "SWF_XI_CUSTOMIZING".

  • BPM(with wait step) calling another BPM

    Hello,
    I have this scenario whereby i need to call a BPM from another BPM process. Call it BPM1 and BPM2. BPM1 will have a Sync-Send-step to call BPM2.
    The following is what i have setup:-
    Working OKAY:-
    BPM1 (receive from file, send syn step to BPM2) --> BPM2(receive step (Open S/A Brige) from BPM1, send step (Close S/A Bridge))
    But if i put an wait step (for 1 minute, see below) before the send syn step in BPM1, i will have problem and the queue in BPM1 show "STOP" and the BPM2 queue show "RETRY".
    Problem:-
    BPM1 (receive from file, wait step, send syn step to BPM2) --> BPM2(receive step (Open S/A Brige) from BPM1, send step (Close S/A Bridge))
    Yes, the RETRY will work but the problem is, my BPM1 has already timeout and has ERROR (see from SWWL) and BPM2 has exceptional error in the Close A/S Bridge send step (because it can't send back to BPM1).
    Anyone has any idea how to resolve this? and hopefully the above is clear enough to discribe the problem that i'm facing now.
    Any suggestions are welcome, scott.

    The minimum BPM-wait duration is 1 min and cannot be decreased below that....

  • Exception handling without BPM

    Hello,
    I have done exception handling with BPM.
    i.e. when there exception comes in mapping I have use Block  Exception Handler.
    Can this be done without BPM.
    Please snd me blog for it.
    Regards

    Hi,
    As explained by Michal it is correct, but in message mapping , we can raise an alert .
    See the below links
    Alerts with variables from the messages payload (XI) - UPDATED - /people/michal.krawczyk2/blog/2005/03/13/alerts-with-variables-from-the-messages-payload-xi--updated
    Triggering XI Alerts from a User Defined Function - /people/bhavesh.kantilal/blog/2006/07/25/triggering-xi-alerts-from-a-user-defined-function
    Regards
    Chilla

Maybe you are looking for

  • ISE Radius - Access-accept is returned with no autorization policy

    Hello, With ISE Radius service / PAP, the authentication passes OK, but the Network Element which send the autorization request, returns message "not enough user priviledges to execute command" and the HTTP page is blank. The reason for that is, the

  • First Video Export to DVD Question

    Hi - I have my first ever video export from Premiere to a DVD and I'm a little nervous about it.  My footage will be shot with the Panasonic ACHD (I think that's the model as I don't have the camera with me here) and the camera is set for 1280 x 720

  • Problem with:  select 'c' as X from dual

    Problem with 'select 'c' as X from dual' I get 2 different results when I execute the above with SQLPlus (or java) depending on the instance I am connected to. For one instance the result is a single character and for the other the character is padde

  • Navigation Link from Dropdown List

    I have dropdown boxes each with a list of things. (Don't want to use a pop ups). What I would like to do is - when the user selects one of the named list in the dropdown - it then would go to that page, simple. I can provide a button to take them bac

  • MacBook Pro 1.1 Replacing the optical drive with HD Caddy?

    Hi all, I have had my macBook pro 1.1 A1150 for a while now and way back I did the firmware update for the Superdrive UJ 857 and since then it won't read or write DVD's CD's occasionally it will but in  nutshell it doesn't work. Now I decided to upgr