Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Raise xception

Former Member
0 Kudos

Hi,

whats the use of raise exception in fm.

lets say,

select * from tnamme .....

if sy-subrc <> 0.

raise abcd.

endif.

whats the use if raise abcd.

Thanks in advance

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

For example, if you try to divide any numer with Zero it will raise an exception, and it will go for ABAP dump. Instead of going to dump. In raise event u can give your own description of the error and avoid the program for dump.

Thanks,

Sriram POnna.

3 REPLIES 3

Former Member
0 Kudos

Hi,

For example, if you try to divide any numer with Zero it will raise an exception, and it will go for ABAP dump. Instead of going to dump. In raise event u can give your own description of the error and avoid the program for dump.

Thanks,

Sriram POnna.

Former Member
0 Kudos

Hi,

one can define their own error message or exception.

And hence if at all error occurs it will be easy for us to identify.

Generally, it is used for trapping the error before it goes to dump.

hope this helps.

Former Member
0 Kudos

Hi Rahul,

RAISE statement is used to raise an exception from within the FM.

As you might know, a FM is always called from somewhere (a calling program) and cannot execute on its own. So, when the FM comes across a situation where it wants to raise an exception it raises it using RAISE statement and this is passed on to the calling program by a non-zero SY-SUBRC value. This exception must be defined in the EXCEPTIONS tab of the FM.

The FM, optionally, can handle the situation but if it wants the calling program to handle the situation, RAISE statement does the job.

Hope this helps.

Thanks

Sanjeev