Application Development and Automation 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: 
Read only

exceptions in function module

Former Member
0 Likes
1,562

Hi,

What are the exceptions in function module.

Thanks in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,173

Hi Mallela,

They are the errors that can be generated when the function module is processed. they can be handled by checking the sy-subrc values after calling the function module

Regards,

Vidya.

7 REPLIES 7
Read only

Former Member
0 Likes
1,174

Hi Mallela,

They are the errors that can be generated when the function module is processed. they can be handled by checking the sy-subrc values after calling the function module

Regards,

Vidya.

Read only

Former Member
0 Likes
1,173

if you get an error, instead of making the program going to dump,we will catch them and put them as EXCEPTIONS.

or

if you get any unaccepted conditions,you will through them as Exceptions.

just check any standard function modules

like,

GUI_DOWNLOAD,or GUI_UPLOAD to know how to define the exceptions and how to call them.

regards

srikanth

Read only

Former Member
0 Likes
1,173

Exceptions in function modules or classes denote those situations where the function module or class has failed to perform the task for which it is intended.In such cases we fill the exception tab in function or class with all possible exception cases that can be anticipated.

These exceptions can be caught in the program by using the system variable sy-subrc.

if sy-subrc eq 0.

*success.

else.

*exception.

endif.

Read only

dani_mn
Active Contributor
0 Likes
1,173

HI,

Exceptions are used to return the error which happens in function module to the calling program.

You can't show error messages directly from Function modules. So when there are some error occurs in function module it raises the desired exception. and this exception number is passed back to calling program. in this way calling program can trace out the error happens in function module.

REgards,

Read only

Former Member
0 Likes
1,173

Exceptions are un foreseen situations in the flow of the Function module execution.

YOu cannot raise error messages in a function module but the calling program should know that something unexpected has happened.

In such situations, exceptions are raised.

eg:

raise exception no_data.

These exceptions can be caught after the function module call using the sy-subrc value.

Regards,

Ravi

Read only

Former Member
0 Likes
1,173

These are the errors that functon module developer have handled in the function module.

Errors/ Exceptions can raise due to some conditions in function module, now what you can do is define your own exceptions. and when ever that perticulat error condition is faced simply raise the appropriate error/exception condition.

This is a very useful method to distinguish between different type of errors generater during function calls.

Read only

Former Member
0 Likes
1,173

Hi,

Exceptions in FM are used to handle errors in

program like divide error.

Regards

amole