Skip to Content

How to handle method based exceptions in webdynpro abap?

Hi ,

    I want to raise an exception from my method.....I am doing division operation inside my method...when I am entering a very large amount , that time I am getting run time error.....please someone help me to catch this exception and display on browser.

Thanks & Regards

Suman Kumar

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Mar 04, 2014 at 06:46 AM

    Hi Suman,

    You can catch the arithmetic exception by using exception class CX_SY_ARITHMETIC_ERROR as below

    Sample code:

              data lv_ex_msg               type string.

              data lx_sy_error              type ref to CX_SY_ARITHMETIC_ERROR.

              try.

                   "here goes your code

              catch CX_SY_ARITHMETIC_ERROR into lx_sy_error.

                               "  you can get exception text as below

                             lv_ex_msg = lx_sy_error->get_text( ).

                             or

                           

                         " lv_ex_msg = lx_sy_error->get_longtext( ).

              endry.

    Hope this helps you.

    Regards,

    Rama

    Add comment
    10|10000 characters needed characters exceeded