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

Catch CONVT_NO_NUMBER runtime error in OO ABAP Program

Former Member
0 Likes
9,649

Hi all,

In our abap proxy program, sometimes the CONVT_NO_NUMBER will happen and cause the program dump. I noticed that this error cannot be caught by CX_ROOT exception class.

Some told me I can use the CATCH SYSTEM-EXCEPTIONS sentence to catch this runtime error, but it is a old-way syntax and cannot be used with the "try" and "catch".

So, how can I catch this runtime error and avoid the dump of our program?

Thanks,

YiNing

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
5,193

Here's a link talking about the same issue.

Not all errors are catchable, is that true?

Hi all,

In our abap proxy program, sometimes the CONVT_NO_NUMBER will happen and cause the program dump. I noticed that this error cannot be caught by CX_ROOT exception class.

Some told me I can use the CATCH SYSTEM-EXCEPTIONS sentence to catch this runtime error, but it is a old-way syntax and cannot be used with the "try" and "catch".

So, how can I catch this runtime error and avoid the dump of our program?

Thanks,

YiNing

13 REPLIES 13
Read only

Former Member
0 Likes
5,193

Hi,

Check below thread

/thread/69351 [original link is broken]

http://help.sap.com/saphelp_webas610/helpdata/en/c3/021950f06111d4b2eb0050dadfb92b/content.htm

Regards,

Atish

Read only

5,193

link not valid. SAP links and SAP forum links make no sense in case of sap, because SAP changes them all the time. Copy of original text is only solution.

Read only

0 Likes
5,193

17 years after, even in other forum, not sure the link on documentation survive this timelaps

Read only

Former Member
0 Likes
5,194

Here's a link talking about the same issue.

Not all errors are catchable, is that true?

Read only

0 Likes
5,193

Not clear what are you asking?

Read only

0 Likes
5,193

How to catch the CONVT_NO_NUMBER error in a OO ABAP program.

Read only

0 Likes
5,193

Have you checked the links I provided. Aren't they useful?

Regards,

Atish

Read only

0 Likes
5,193

Hi, Atish. The 1st link you gave me suggests that "CATCH SYSTEM-EXCEPTIONS" can be used to solve this problem. But as I said, it seems that "Catch... End Catch" cannot be used with "try...catch".

The 2nd link suggests us to use the "CX_SY_CONVERSION_NO_NUMBER" Exception Class to catch the runtime error, I did have try it and has no effect.

Read only

0 Likes
5,193

What is the problem with the class CX_SY_CONVERSION_NO_NUMBER. It should work,

Regards,

Atish

Read only

5,193

No, it doesn't work.

Try the follwing code:

TRY.
    IF 'A' > 5.
    ENDIF.  
    CATCH CX_SY_CONVERSION_NO_NUMBER.
ENDTRY.

The program will still dump.

Read only

0 Likes
5,193

Hi,

You are not checking for conversion.

You are checking ofr logical expression.

Try below code, it works

DATA error_ref TYPE REF TO cx_sy_conversion_no_number.

DATA err_text TYPE string.

DATA a TYPE i.

TRY.

MOVE 'A' TO a.

CATCH cx_sy_conversion_no_number INTO error_ref.

err_text = error_ref->get_text( ).

WRITE err_text.

ENDTRY.

Regards,

Atish

Read only

mujeebs_ww
Discoverer
0 Likes
5,193

use MOVE statement within TRY ... CATCH block. It will catch the run-time errors.

TRY.
MOVE 'abcd' TO lv_num.

CATCH cx_root INTO DATA(lv_cerr).

DATA(lv_mesg) = lv_cerr->get_text( ).
WRITE / lv_mesg.
CLEAR lv_num.

ENDTRY.

Read only

vonglan
Active Participant
0 Likes
3,830

You can also use

TRY.
numeric_variable = EXACT #( character_variable ).
CATCH cx_sy_conversion_no_number.
ENDTRY.