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: 

Exception Handling for a function module

Former Member
0 Kudos

There is a function module the program in which exceptions are handled. When the program is ran as a background job and when there is a exception arises does the background job fails or the exception gets handled ??? Pls help me out.....

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

If the exception is being handled by the caller, meaning that the exception is listed in the EXCEPTIONS section of the funciton call, then the program will handle it gracefully and continue processing, if it is not in this section of the funciton call, and it is raised inside the funciton module, it will issue an ABAP dump and end. This is true for foreground processing as well as background processing.

Regards,

Rich Heilman

3 REPLIES 3

FredericGirod
Active Contributor
0 Kudos

if you have specify :

EXCEPTIONS

OTHERS = ..

you program will not stop.

Fred

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

If the exception is being handled by the caller, meaning that the exception is listed in the EXCEPTIONS section of the funciton call, then the program will handle it gracefully and continue processing, if it is not in this section of the funciton call, and it is raised inside the funciton module, it will issue an ABAP dump and end. This is true for foreground processing as well as background processing.

Regards,

Rich Heilman

Former Member
0 Kudos

it raises an exception you can catch it.

cx_root is the root class for exceptions.

DATA: ex TYPE REF TO CX_ROOT.

TRY.

call fm.

...

CATCH cx_root INTO ex.

ENDTRY.

message = cx_root->get_text( ).

this way your program will not stop..

regards,

Aparna