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: 

how to catch exception i defined in the function module

Former Member
0 Kudos

I defined the exception 'no_value_found' in the function module, now, the problem is how to catach it in the program calling it

10 REPLIES 10

Former Member
0 Kudos

if standard FM then just include exceptions

0 Kudos

No, it is not standard FM, i created it

Former Member
0 Kudos

Hi Yong li,

You can catch the Exceptions by using Exception Handling in your FM.

Reward if useful.

Regards,

Shilpi

0 Kudos

Hi shilpi, could you give me one example, thanks

Former Member
0 Kudos

Hi,

In the calling program just check the sy-subrc value after the FM and based on that handle the exception. If you had only one exception then check for sy-subrc =1.

Regards,

Atish

0 Kudos

Hi Atish

I have used sy-subrc to handle it in the program, howerver, it is still encounter runtime error:

-


Error message -


A RAISE statement in the program "SAPLZERC" raised the exception

condition "NO_OBJECT_INFO_FOUND".

Since the exception was not intercepted by a superior

program, processing was terminated.

Short description of exception condition:

No object information found

For detailed documentation of the exception condition, use

Transaction SE37 (Function Library). You can take the called

function module from the display of active calls.

-


Errors is at following position:----


39 ELSE.

>> RAISE NO_OBJECT_INFO_FOUND.

41 ENDIF.

0 Kudos

Have you defined NO_OBJECT_INFO_FOUND this exception in FM.

If not, define it. Also paste your program and FM code.

Regards,

Atish

0 Kudos

Yes, i defined it, but still have error

Former Member
0 Kudos

Hi Yong,

make used of sy-subrc values & than set raise the exception you want to catch in your program. say for example if your select query return is false than

select * into ...

if sy-subrc ne 0.

raise no_value_found.

endif.

hope this help you

~John.

Former Member
0 Kudos

Thanks guys. The problem is solved.