Exceptions classes in 4.6C

Hello SDNers,
as Uwe had already written in the thread Throw statement equivalent in ABAP Objects.
What would be better?
1. Would you try to develop in 4.6C the exception classes
   (plenty of work, but keeping myself updated, and I can use them also in the future)
  CX_ROOT                             -> ZCX_ROOT; ZIF_MESSAGE
  CX_STATIC_CHECK (I need this slass) -> ZCX_STATIC_CHECK
2. just to solve the problem with traditionally
  METHOD get_xxx.
    IF sy-subrc = 0.
    ELSE.
        RAISE wrong_xxxx.
    ENDIF.
  ENDMETHOD.
With regards,
Peter

You may appreciate that whatever is possible in OO ABAP is still possible in procedural ABAP with difference in the extent of SW reusability, visibility control etc. So its a design decision whether to go for OO ABAP. In case you have a business case for a class ( you feel that the class will be used many times in your project, you need to control visibility, you have chances of enhancing the functionality of the class, you do not want to incur more resources in testing etc. ), you can go for the development of the exception class.
Otherwise traditional development may be helpful.

Similar Messages

  • Get the values from Exception class

    Hi all ..
    In class i have raised one exception
    when i catch this exception in my program i m able to get the
    error message but i need to get all the parameters that i pass
    when i raise the exception ...
    i have raised like this
          RAISE EXCEPTION TYPE cx_bapi_error
            EXPORTING
              textid = cx_bapi_error=>cx_bo_error
              class_name = 'ZHS_'
              log_no = wa_bapi_return-log_no
              log_msg_no = wa_bapi_return-log_msg_no
              t100_msgid = wa_bapi_return-id
              t100_msgno = wa_bapi_return-number
              t100_msgv1 = wa_bapi_return-message_v1
              t100_msgv2 = wa_bapi_return-message_v2
              t100_msgv3 = wa_bapi_return-message_v3
              t100_msgv4 = wa_bapi_return-message_v4
              STATUS = lt_status
    and caught the exception like this in my program
        CATCH cx_bapi_error INTO go_error.
          gd_text = go_error->get_text( ).
          EXIT.
      ENDTRY.
    in this i m just getting the class name which i have passed in exception
    i need all other parameters that i have passed ..
    if u have any idea pls let me know ..
    Thanks in advance ...

    Hello Jayakumar
    Usually the attributes of standard exception classes are defines as <b>public</b> and <b>read-only</b>. Thus, you should be able to use the following coding:
    DATA:
      go_error   TYPE REF TO cx_bapi_error.  " specific exception class !!!
    TRY.
    RAISE EXCEPTION TYPE cx_bapi_error
    EXPORTING
    textid = cx_bapi_error=>cx_bo_error
    class_name = 'ZHS_'
    log_no = wa_bapi_return-log_no
    log_msg_no = wa_bapi_return-log_msg_no
    t100_msgid = wa_bapi_return-id
    t100_msgno = wa_bapi_return-number
    t100_msgv1 = wa_bapi_return-message_v1
    t100_msgv2 = wa_bapi_return-message_v2
    t100_msgv3 = wa_bapi_return-message_v3
    t100_msgv4 = wa_bapi_return-message_v4
    STATUS = lt_status.
    CATCH cx_bapi_error INTO go_error.
    gd_text = go_error->get_text( ).
    WRITE: go_error->t100_msgid,  " perhaps the attributes have different name
                go_error->t100_msgno, " check attribute names in SE24
    EXIT.
    ENDTRY.
    Regards
      Uwe

  • DAC ERROR EXCEPTION CLASS::: java.lang.NullPointerException

    hello guru,
    when i creating a execution plan in my local envt for testing
    I have assemble the subject area
    but while building the execution plan i am getting below error:
    SHTEST-TEST
    EXCEPTION CLASS::: java.lang.NullPointerException
    com.siebel.analytics.etl.execution.ExecutionParameterHelper.substituteNodeTables(ExecutionParameterHelper.java:174)
    com.siebel.analytics.etl.execution.ExecutionParameterHelper.parameterizeTask(ExecutionParameterHelper.java:141)
    com.siebel.analytics.etl.execution.ExecutionPlanDesigner.getExecutionPlanTasks(ExecutionPlanDesigner.java:738)
    com.siebel.analytics.etl.execution.ExecutionPlanDesigner.design(ExecutionPlanDesigner.java:1267)
    com.siebel.analytics.etl.client.util.tables.DefnBuildHelper.calculate(DefnBuildHelper.java:169)
    com.siebel.analytics.etl.client.util.tables.DefnBuildHelper.calculate(DefnBuildHelper.java:119)
    com.siebel.analytics.etl.client.view.table.EtlDefnTable.doOperation(EtlDefnTable.java:169)
    com.siebel.etl.gui.view.dialogs.WaitDialog.doOperation(WaitDialog.java:53)
    com.siebel.etl.gui.view.dialogs.WaitDialog$WorkerThread.run(WaitDialog.java:85)
    can anyone help on this.
    thanks

    Hello Shiva,
    I have tried to generate the paramenter index in going into execute tab.
    Acutally I have two database one is SH(for sales fact table) as source and other is SHTST (for target w_sales_F).
    when i go into that it try to click on generate button it shows only for SHTST not for SH
    more over in SHTST the value is coming as Informatica folder Sales where i created all mapping.
    SH and SHTST both are in same database oracle 10g.
    please help

  • ABAP OO Exception Class based processing

    Hi there,
    Note: In going forward with SAP WAS 6.20, one can handle exceptions using exception-class based handling using RAISE EXCEPTION TYPE abc and then CATCHing it in TRY/ ENDTRY block. Standard method like GET_TEXT can be used to get the text of the exception raised.
    Question: If I know the EXCEPTION CLASS and Exception ID of my exception class, is it possible to get the exception text directly from the repository without creating the exception class object?
    E.g. Exception class is CX_MY_SECRET_ID
    and Exception IDs for this class are
    ID_NOT_FOUND,
    ID_EXPIRED,
    ID_IS_FOR_SPECIAL_ACCESS
    E.g. last two exception IDs are my warning conditions, and if such conditions are encountered, all I want to do is collect the warning messages. Whereas first exception ID condition (i.e. ID_NOT_FOUND) is an error for me, in which I have pass the exception back to the calling program. E.g. the source code is like this:
    PERFORM.......
    If ID is not found
       RAISE EXCEPTION TYPE ZCX_MY_SECRET_ID
               EXPORTING TEXT_ID = 'ID_NOT_FOUND'.
    else if ID has expired
       ...... then do I have to first raise the exception like raised above and CATCH it before I can get its text? or can I get the exception text directly without raising the exception first (as I know i have to retrieve the text of ZCX_MY_SECRET_ID exception class for Exception ID ID_EXPIRED)?
    In other words, if a certain condition is warning for my program, can I get the condition for that exception (from exception class based on exception class name and exception ID), or do I have to RAISE it first explicitely and then CATCH it immediately and execute GET_TEXT to get its text?
    Thanks very much!

    Hello Chetan,
    in basic the raise exception type xxx creates an exception object and aborts normal execution continuing in the enclosing try block.
    The Abap runtime contains some optimizations regarding the try block has an 'into xxx' clause. But as long you use the same exception you cant take benefit from this.
    As far I understand your problem you have two different kind of severities. So I would use 2 differnt exception classes (maybe derived from a common parent type, or one from the other).
    So both the code which throws the exception and the one which catches it are aware of the different semantic.
    Kind Regards
    Klaus

  • ABAP OO Exception Class

    Class Based Exception Handling involves raising exception (RAISE EXCEPTION TYPE), catching it (CATCH within TRY/ENTRY block) and maybe execute GET_TEXT method to get the text for that exception.
    Allowing exception texts be stored as part of exception classes, does that mean that SAP is moving away from using SAP Message Class (transaction SE91 messages) and relying now onwards upon storing texts in respective Exception Clases?
    My understanding is that SE91 holds not only the texts for exceptions (or hard errors) but also informational and warning messages, and hence if program condition has to display an informational or warning message, there is not need to create an Exception Class for such a condition (and then get the TEXT for that informational message from that Exception Class). Right?
    Pls explain. Thanks much.

    Hi Chetan,
    Sap is not moving away from T100-based (SE91) messages at all.
    In fact you do not store exceptions texts in exception classes but in the OTR (Online Text Repository) and still in T100. If an exception class implements the interface IF_T100_MESSAGE (as of Release 6.40), you can use the statement
    MESSAGE excref TYPE ...
    to display the message after
    CATCH INTO excref.
    It is recommended to use T100-messages for texts send to the user via MESSAGE and OTR-texts for texts not sent to the user but used internally, e.g. for writing into logs.
    Regards
    Horst

  • Exception class: RFC not found

    Hi,
    Do you know whether there is an exception class in web dynpro java that i can catch in case the RFC is not found in the backend system?
    Thanks and regards,
    Nada

    Thank you!
    Are the mentioned exceptions general exceptions if something is going wrong with the execute() method or they are specific for the problem 'RFC not found in the backend).
    So I need this specfic information that the RFC is not found in the backend.

  • Exception class log

    Hi all,
    i build exception class with massages ,and i want to know if there is log that
    manage this exception ? i,e. where i can see the exception's of the program if they occur .
    Best regards
    Nina

    Hi Nina,
    take a look at the function modules in function group SBAL. They let you add messages to message logs which can be displayed using transaction SLG1.
    You can find more information here:
    [Online help for application logs|http://help.sap.com/saphelp_erp60_sp/helpdata/EN/2a/fa0216493111d182b70000e829fbfe/content.htm]
    Regards,
    David

  • Exception class help

    Hi,
    i create exception class like it write in the sap help and when i want to send the exception with parameters to the ABOVE METHODS i don't susses  i just get the message without the parameter ?
    there is simple guideline how o transfer the exception with parameters?
    br
    Ricardo

    HI Uwe,
    Thanks,
    This is my sample code:
    This is the first method on the tree:
    the method name is create .
    INSERT (lt_table_name) FROM <ls_obj>.
        IF sy-subrc <> 0.
          RAISE EXCEPTION TYPE /cx_db_db_error
            EXPORTING
              textid     = cx_db_error=>create_failed
              table_name = lt_table_name.
        ENDIF.
    this method call to the above method - create .
    TRY.
            CALL METHOD lo_obj_create->create
              CHANGING
                is_bound_object = ls_obj_user.
          CATCH cx_db_error INTO lo_exc.
            "Create user failed. Throw an exception.
            RAISE EXCEPTION TYPE cx_db_error
              EXPORTING
                textid     = cx_db_error=>create_user_error
                previous   = lo_exc.
            result = lo_exc->get_text( ).
        ENDTRY.
    here in result i just get the massage without the table name that i export in the first method ,what i miss here ?
    Best Regards
    Ricardo

  • Exception Class

    Hi,
    What is exception class .
    What is local exception class
    what is global exception class.
    Thanks,
    Medha.

    Hi,
    And also check this doc.
    http://help.sap.com/saphelp_nw04/helpdata/en/fb/35c62bc12711d4b2e80050dadfb92b/content.htm

  • Exception class & Throwable class

    Does the Exception class inherit hashCode from the Throwable class?
    thanks in advance for anyones help??

    No, from Object.
    http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Exception.html

  • Creating own Exception class

    In my past paper it says...
    Show how to create your own Exception class that derives from class Exception. The class should provide a default constructor which allows a "My Error message" message to be set, and a second constructor which has as an argument the error message. 4-MARKS
    Does this look right..?
    public class MyExcep extends Exception
         public MyExcep()
              super("My Error Message");
         public MyExcep(String message)
              super(message);
    }

    Yes. Do I get 4 marks now? or is it Four Marks?

  • Whats is the use of delaring SubType of Exception classes in catch clause

    Hi,
    Just go through the following code.
    String ip="127.0.0.1";
              StringTokenizer st = new StringTokenizer(ip,".");
    int i=0,
              while(st.hasMoreTokens()){
                   String str = st.nextToken();
                   try {
                        i=Integer.parseInt(str);
                   } catch (NumberFormatException e) {
                        System.out.println(e);
    In the above code am using the NumberFormatException to catch clause the exception. But i can also use the super class Exception also in the catch clause, thats okay. Is there reason or advantage of using the particular class say (NumberFormatException) instead of super class (Exception) in the catch clause.
    Is there any reasons like saving the compilation time.
    For example,
    There is an diff' between wild card import and ordinary import.
    2 types of import statements
    1) import java.util.*;
    2) import java.util.ArrayList;
    Here 1st type is wild card import, In this the compiler will import all the classes in that package. But am using only ArrayList in my program. So there is waste of compilation time here. Its is not efficient to use wild card import statement.
    Like this any reason is there while declaring exception class in catch clause??
    Regards,
    Dhinesh Kumar R

    Deenu wrote:
    Is there reason or advantage of using the particular class say (NumberFormatException) instead of super class (Exception) in the catch clause.It's clearer which specific exception you're handling.
    You generally don't want to catch all exceptions.
    In particular, RuntimeException and its descendants usually should not be caught.
    1) import java.util.*;
    2) import java.util.ArrayList;
    Here 1st type is wild card import, In this the compiler will import all the classes in that package. But am using only ArrayList in my program. So there is waste of compilation time here. Its is not efficient to use wild card import statement.It doesn't "import" anything else. Importing doesn't actually load any classes. It just tells the compiler which class you're referring to when you use only the class name instead of the fully qualified name, or in the case of wildcards, tells it where to search to find a class that could match.
    Good luck noticing any difference in compilation time.
    It's clearer to import individual classes.

  • How to use user defined exception class

    Hi all
    I just need som help with creating a user defined exception class.
    Im writing a small/simple text editor.
    My exception class looks like this:
    public class myExcp extends Throwable
         private String message;
         public myExcep(String message)
              this.message = message;
         public void display()
              System.out.println(message);
    I would like to use it when a user tries to open a exe-file instead of a txt file.
    Here is some code from the editor:
    if (e.getSource() == open)
    saveOld();
    if (fc.showOpenDialog(null)== JFileChooser.APPROVE_OPTION)
    readFile(fc.getSelectedFile().getAbsolutePath());           
    saveas.setEnabled(true);                
    So, should I use exception here or at the readFile method?
    readfile:
    private void readFile(String fileName)
    try
    String tmp = fileName.substring(fileName.length() -4, fileName.length());
    if (!tmp.equals(".exe"))
    FileReader r = new FileReader(fileName);
    textarea.read(r, null);
    r.close();
    currentFile = fileName;
    label.setText(currentFile);
    changed = false;
    catch (IOException e)
    JOptionPane.showMessageDialog (this, "Cannot find the file " + fileName);
    Where and how do I use my exception class.
    Do I need to create an instance? Where?
    Should the exception class extend Exception instead?
    Thank you in advance /

    Extend Exception, not Throwable. It's a checked exception that way.
    Follow the Sun coding standards and make that exception class name start with a capital letter.
    When you extend Exception, override all four ctors.
    What's that display method you added? Isn't getMessage() good enough?
    You need to create a new instance just before you throw the exception, of course.
    Sounds like a terrible design, by the way. Exceptions shouldn't be used like "go to" for app logic. They should signal unrecoverable conditions. You can easily recover from the situation you've described simply by displaying a pop-up that tells the user to open only text-readable file types. I think that's a better solution.
    %

  • How to Maintain Translation of texts of Exception Class

    Hi Experts,
    I have an exception class ZCX_CHECK . I have maintained a text in the text tab of the exception class
    like No components  Exists in  Package  &PACKAGE_NAME&
    PACKAGE_NAME is the Attribute . How do I maintain Translation of the TEXT. When I navigate like Goto->Translation , it is saying Empty Object list.
    When I maintain text elements and give text-001 in the text tab of the exception class , the ouptu is coming as text-001 in the Report .
    How do I amintain translation , or how can I integrate a message class with an exception class .I know where to metion messsage class  . But how do I use it inside exception class

    Let me rephrase this: When entering a text in your Exception class it will be automatically part of the OTR. You can check this by looking this up in SOTR_EDIT.Press the binoculars button (Find), and search on package (development class).
    Now via SE63: Translation->ABAP Objects->Short texts
    open node OT on pop-up and double click on Subnode.Enter a * on screen for Object name and press F4. Now enter collection (package / development) class. Select the text to be translated.
    BTW: Via SOTR_EDIT you can retrieve the logical key (field concept) which is needed for translation. Select the GUID (logical key / concept) from SOTR_EDIT.

  • [svn] 3540: Fix for missing name of the exception class, when @ throw is used.

    Revision: 3540
    Author: [email protected]
    Date: 2008-10-09 11:20:44 -0700 (Thu, 09 Oct 2008)
    Log Message:
    Fix for missing name of the exception class, when @throw is used.
    Also fixes for:
    SDK-17212 - Add a line feed between messages in the ASDoc validation_errors.log file.
    SDK-17242 - The Constants.as and GlobalFunctions.as classes from system classes need to have their content added to __Global__.xml
    SDK-17256 - For methods of the mx.components.Group class, args or return values of type Object do not appear in the ASDoc output.
    QA: Yes
    Doc:
    Tests: checkintests
    Ticket Links:
    http://bugs.adobe.com/jira/browse/SDK-17212
    http://bugs.adobe.com/jira/browse/SDK-17242
    http://bugs.adobe.com/jira/browse/SDK-17256
    Modified Paths:
    flex/sdk/trunk/asdoc/templates/class-files.xslt
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/asdoc/AsDocUtil.java
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/asdoc/ClassTable.java
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/asdoc/TopLevelClassesGenerator.ja va

    Revision: 3540
    Author: [email protected]
    Date: 2008-10-09 11:20:44 -0700 (Thu, 09 Oct 2008)
    Log Message:
    Fix for missing name of the exception class, when @throw is used.
    Also fixes for:
    SDK-17212 - Add a line feed between messages in the ASDoc validation_errors.log file.
    SDK-17242 - The Constants.as and GlobalFunctions.as classes from system classes need to have their content added to __Global__.xml
    SDK-17256 - For methods of the mx.components.Group class, args or return values of type Object do not appear in the ASDoc output.
    QA: Yes
    Doc:
    Tests: checkintests
    Ticket Links:
    http://bugs.adobe.com/jira/browse/SDK-17212
    http://bugs.adobe.com/jira/browse/SDK-17242
    http://bugs.adobe.com/jira/browse/SDK-17256
    Modified Paths:
    flex/sdk/trunk/asdoc/templates/class-files.xslt
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/asdoc/AsDocUtil.java
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/asdoc/ClassTable.java
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/asdoc/TopLevelClassesGenerator.ja va

Maybe you are looking for

  • How to set password for photos from home screen? Please help.

    Hi, Can anyone pls help to set password for my Iphone 4s. My friends/family often use my phone for gaming purpose. I don't want them to see my photos/gallery/videos. How can I protect my personal things from others? Thnx. Rgds.

  • Outer join in view criteria

    Hi everybody I use jdeveloper 11.1.1.6.0 I want to create outer join in view criteria, so I had to override getCriteriaItemClause method in ViewObjImpl.java my query is like this : SELECT t1.row_no, t2.type FROM   table_1  t1 , table_2  t2 WHERE   t1

  • Process for applying for Solution Manager Key?

    I have to install a NW2004s system in a AIX Machine. I understand that i need a solution manager key for installation. We dont have solution Manager installed in our Landscape. But i came to know that i can request for a solution manager key from SAP

  • Cs4 serial number doesn't work with mavericks

    CS4 upgrade from  CS2 was installed on a mac running OS 10.9.2, the 30 day trial allowed photoshop to work, however, the serial number from the box does not work.  Everything seemed to work properly on the previous computer running 10.8

  • Problem with Process 2012 in Bridge CS5

    I can't use Process 2012 in CS5 Bridge.  It always makes me go back to 2010.  I think I have the latest ACR, and use this in LR4.  Anyone else experience this? Thanks, Dave