F Simple Try Catch Program in SAP ABAP | CodeTheta

Simple Try Catch Program in SAP ABAP

September 10, 2023

I have used CX_SY_ZERODIVIDE class to handle exception.

Code :

REPORT zvp_try_catch.

DATATYPE int4.

PARAMETERSp_a TYPE int4,
            p_b TYPE int4.

START-OF-SELECTION.

  TRY .
      p_a / p_b.
      WRITEc.
    CATCH cx_sy_zerodivide.
      WRITE:'Error!! Divided by zero'.
  ENDTRY.

IDE Used To Test This Code : ABAP Editor.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us. We will reply you as soon as possible.

Post a Comment