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.


                   "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( ).



                         " lv_ex_msg = lx_sy_error->get_longtext( ).


    Hope this helps you.



    Add comment
    10|10000 characters needed characters exceeded