Exception class- CX_NO_CHECK
Exceptions that are defined using sub classes of CX_NO_CHECK may not be explicitly declared in the interface of the procedure. Class CX_NO_CHECK and its subclasses are always implicitly declared and are always propagated.
When calling a procedure, the user must therefore always expect that the procedure will propagate exceptions of the category CX_NO_CHECK as well as the explicitly declared exceptions.
Step1. Go to Tx- SE24 and provide an exception class name and click on create button.
Step2. Provide the super class as : CX_NO_CHECK & select the exception class radio button and save it.
Step3. Activate the class.
Step4. Go to Tx- SE38 and create the below report program. Now the CHECK method declares the exception in the signature but when activating the program it throws a syntax error. Because no method should declare any exception with RAISING clause that is subclass of CL_NO_CHECK.
Step5. Now remove the RAISING and activate the program. RUN it.
Step6. As the exception is not caught anywhere in the call hierarchy it throws a run time error.
Step7. Now put a TRY CATCH ENDTRY block in the method CHECK where the exception is raised and execute the program.
Step8. So we have the below output.
Step9. Now remove the TRY CATCH ENDTRY from inside the CHECK method and put it in the RUN method from where CHECK method is called & execute the program. Though there is no Raising clause for the method check but the raised exception in side the CHECK method can be handled in the up call hierarchy. Execute the program.
Step10. So here the exception is raised and handled successfully.
Step11. Now remove TRY CATCH ENDTRY from the run method & put TRY CATCH ENDTRY in the start-of-selection from where the RUN method is called. Execute the program.
Step12. So though the exception is raised in the CHECK method it can be handled any where in the call hierarchy without a raising clause in the method interface.