Your error is not so much a calculation error but a "syntax error" evoking "add" method. So to solve it you have to put validations somewhere else. If you place them inside your method you encapsulate your validations and can repeat them with every method call. So, you are right, it's the same thing, but it's probably more useful and scalable inside the method. So my idea was doing what Mathew did. You don't need to use type i variables as you mentioned.
CLASS lcl_calculator DEFINITION.
PUBLIC SECTION.
METHODS: add IMPORTING i_op1 TYPE data i_op2 TYPE data RETURNING VALUE(r_val) TYPE i RAISING cx_sy_arithmetic_error.
ENDCLASS.
CLASS lcl_calculator IMPLEMENTATION.
METHOD add.
TRY.
r_val = i_op1 + i_op2.
CATCH cx_root.
WRITE:/ 'Error inside method'.
RAISE EXCEPTION TYPE cx_sy_arithmetic_overflow.
ENDTRY.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
DATA:
lo_calculator TYPE REF TO lcl_calculator,
l_result TYPE i.
DATA: lr_err TYPE REF TO cx_root.
CREATE OBJECT lo_calculator.
TRY.
l_result = lo_calculator->add(
i_op1 = '1000000000000'
i_op2 = 1 ).
WRITE:/ l_result.
CATCH cx_root INTO lr_err.
WRITE:/ 'Error outside method'.
ENDTRY.
regards,
Edgar