Show TOC

Code Example Before ExecutionLocate this document in the navigation structure

CLASS cx_failure DEFINITION
  INHERITING FROM cx_static_check.
ENDCLASS.

CLASS cx_no_fuel DEFINITION
  INHERITING FROM cx_static_check.
ENDCLASS.


CLASS cl_car DEFINITION. 
  PUBLIC SECTION. 
    METHODS: 
      drive, 
      check_fuel RAISING cx_no_fuel, 
      check_engine RAISING cx_failure. 
ENDCLASS. 

CLASS cl_car IMPLEMENTATION. 
  METHOD drive. 
    TRY. 
        check_fuel( ). 
        check_engine( ). 
      CATCH cx_no_fuel. 
        "handle exception 
      CATCH cx_failure. 
        "handle exception 
    ENDTRY. 
  ENDMETHOD. 
  METHOD check_fuel.
    RAISE EXCEPTION TYPE cx_no_fuel.
  ENDMETHOD.
  METHOD check_engine.
    RAISE EXCEPTION TYPE cx_failure.
  ENDMETHOD.
ENDCLASS.