Google Search - Blog...........

ABAP - Nested TRY - ENDTRY Block - Example.

REPORT YSUBCLASS_EXCEPTION_3.

START-OF-SELECTION.

DATA : num type i value 5 .

TRY.
TRY.
NUM = NUM / 0.
CATCH cx_sy_ZERODIVIDE .
WRITE:/5 'Division by 0 caught'.
NUM = 'SUBHENDU'.
ENDTRY.
CATCH cx_sy_conversion_no_number.
WRITE:/5 'Cannot be converted to number'.
ENDTRY.


Output:

Division by 0 caught
Cannot be converted to number

No comments:

Post a Comment