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

How to CATCH error from call to standard SAP Function Module

Former Member
0 Likes
3,118

Please, is it possible to catch the following error with the TRY CATCH ENDTRY construct?

From a custom program, am calling CS_BOM_EXPL_MAT_V2.

Several nested calls in, Form STL_DATEN_HOLEN (LCSS4F1I) calls FM CS_ALT_SELECT_MAT.

However, that call is missing the CALL_INVALID Exception.

CS_ALT_SELECT_MAT is raising CALL_INVALID, but since it was not included in the FM call, the RAISE_EXCEPTION runtime error is issued.

I added a TRY CATCH ENDTRY construct around the call in the custom program using CATCH cx_root, but the program is still short dumping.

All the research I have done has been misleading...some articles indicate all errors should be caught, some indicate only catchable runtime errors can be caught, others are not quite clear.

So, I would like to find out if, in this scenario, it is even possible to catch this error and avoid the short dump.

I will open a message to see about having the SAP code fixed as soon as I get authorization to do so, (as well as fix the data causing the issue in the first place), but in the meantime, I would like to handle it in my code if possible.

ECC 6.0

Thanks for any information!

Kind Regards,

Deb

Edited by: Debra Garner on Jan 26, 2012 5:19 PM

Please, is it possible to catch the following error with the TRY CATCH ENDTRY construct?

From a custom program, am calling CS_BOM_EXPL_MAT_V2.

Several nested calls in, Form STL_DATEN_HOLEN (LCSS4F1I) calls FM CS_ALT_SELECT_MAT.

However, that call is missing the CALL_INVALID Exception.

CS_ALT_SELECT_MAT is raising CALL_INVALID, but since it was not included in the FM call, the RAISE_EXCEPTION runtime error is issued.

I added a TRY CATCH ENDTRY construct around the call in the custom program using CATCH cx_root, but the program is still short dumping.

All the research I have done has been misleading...some articles indicate all errors should be caught, some indicate only catchable runtime errors can be caught, others are not quite clear.

So, I would like to find out if, in this scenario, it is even possible to catch this error and avoid the short dump.

I will open a message to see about having the SAP code fixed as soon as I get authorization to do so, (as well as fix the data causing the issue in the first place), but in the meantime, I would like to handle it in my code if possible.

ECC 6.0

Thanks for any information!

Kind Regards,

Deb

Edited by: Debra Garner on Jan 26, 2012 5:19 PM

8 REPLIES 8
Read only

Former Member
0 Likes
2,099

can u show us the fm call alog with try catch that you have used?

Read only

0 Likes
2,099

TRY.

me->explode_bom( EXPORTING i_projn = <afpo_ei>-projn

i_matnr = <afpo_ei>-matnr

i_werks = <afpo_ei>-dwerk

CHANGING et_bom_list = gt_bom_list ).

CATCH cx_root.

CONTINUE.

ENDTRY.

Read only

0 Likes
2,099

which is the class, is it standard or your custom?

can you paste the code inside explode_bom method if its you own method

Read only

Ryan-Crosby
Active Contributor
0 Likes
2,099

Hi Debra,

You cannot catch non class based exceptions using the TRY/ENDTRY. You might also find no luck with help from SAP since the FM in question 'CS_BOM_EXPL_MAT_V2' is not released for customer use. The best bet is to examine why the error is occurring and figure out what needs to be done to fix it and/or avoid it in the future.

Regards,

Ryan Crosby

Read only

0 Likes
2,099

So the answer is NO.

Thanks very much!

Read only

0 Likes
2,099

Next time, please assign points to helpful answers. It will encourage people to help you in the future.

Rob

Read only

0 Likes
2,099

I assigned 6 points to Ryan when I said my question was answered. How do I tell if he got them?

Read only

0 Likes
2,099

You did. I see it now.

Rob