
You can create a global exception class when you need it for the first time, for example, when you are assigning exceptions in the method definition.
See also Creating Exceptions for Methods.
Create
Class Library
Class
.The prefix CX_ should be added to the names of all exception classes.
| Option | Description |
|---|---|
|
Superclass |
Enter the name of the direct superclass. Note
Exception classes are derived from one of the predefined basic classes CX_STATIC_CHECK, CX_DYNAMIC_CHECK or CX_NO_CHECK. Depending on the position of the exception class within the class hierarchy, enter the appropriate class within this hierarchy or one of the predefined basic classes as a superclass. In the latter case, expand a new hierarchy tree. |
|
Instantiation |
|
|
Class Type |
If you assign the prefix CX_ to the name of the
exception class, the class type Exception class is automatically
selected. You must define one or more exception texts to an
exception class. Exception texts can be stored as messages in the
T100 database table or in the Online Text Repository (OTR).
Recommendation
SAP recommends using exception texts stored in T100 only. Texts from OTR are reserved for system exceptions provided by SAP. So that you can use exception texts from T100, the With messages of message classes as exception texts checkbox is selected by default. Unchecking this means that exception texts from OTR are used (not recommended). If you use exception texts stored in T100, the exception class automatically implements the IF_T100_DYN_MSG interface, which itself implements the IF_T100_MESSAGE interface. Both interfaces connect classes with messages. For more information, see the Related Information below. |
|
Final |
Specifies the development status of the object. Only objects and components with this status can have executable code. This class completes the inheritance hierarchy since a final class may not create any further subclasses. |
A new exception class is created. A class pool is generated for the new class if the Only modeled option was not activated.
In contrast to the situation with normal classes, you cannot create a method for an exception class. The Class Builder simply creates the constructor, but you can create attributes and maintain exception texts.