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

regarding Function Module

Former Member
0 Likes
591

Hi,

Why we cann't throw an erroe message from Function module?

if we want to give any errors from it,

why why we use exceptions and return codes?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
551

Hello,

Function modules will funciton independently, is it possible to use FM directly ? No isn't ?.

So generally we call FM from driver program or what ever it may be, it has to return back. So raising the error in the FM will not solve the purpose, you have to some how capture the error and display it to the user. AIf you want to raise the error in the FM you can do it so, but the continuty with the driver program or the other will get lost. Because it has to return back to the calling program.

I hope this is suffice.

Regs,

Venkat Ramanan N

Message was edited by: Venkat Ramanan Natarajan

4 REPLIES 4
Read only

dani_mn
Active Contributor
0 Likes
551

HI,

If it shows error in the FM then processing stops in the FM and not to the calling program. SO it is matter of control.

the error message can be shown after the function module returns back, there are exception to detect the error.

Control is given back to calling program and it can check what happens in the FM using exception and can show relavent error message.

Regards,

Read only

andreas_mann3
Active Contributor
0 Likes
551

hi,

i don't get your request.

in fm we use the command raise exception to throw an error-message - in the calling program you've to analyse the return-code (sy-subrc) and react to the err.-situation

A.

Message was edited by: Andreas Mann

Read only

Former Member
0 Likes
551

Hi Shefali,

Showing an error message in a FM could be requirement of 1 User but it need not be requirement of another user.

What this means is , If a PO is created/Warning generated during PO creation using FM BAPI_PO_CREATE1, one business user need not treat it as error or warning and hence it do not want a error/warning message to be displayed but another user would like to display an error message.

Hence Exception/Return message are EXport paramters of FM. So depending on your requirement you can handle the Exception/Return Parameters.

Best regards,

Prashant

PS : Please reward all helpful answers

Read only

Former Member
0 Likes
552

Hello,

Function modules will funciton independently, is it possible to use FM directly ? No isn't ?.

So generally we call FM from driver program or what ever it may be, it has to return back. So raising the error in the FM will not solve the purpose, you have to some how capture the error and display it to the user. AIf you want to raise the error in the FM you can do it so, but the continuty with the driver program or the other will get lost. Because it has to return back to the calling program.

I hope this is suffice.

Regs,

Venkat Ramanan N

Message was edited by: Venkat Ramanan Natarajan