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: 

Urgent problem, give me a hand

Former Member
0 Kudos
199

Hello experts:

Thank you in advance for all your replies.

there is message popped up say"" Old and new exceptions cannot be used at the same time . . . . . . "" while trying to activate the following code.

DATA: lv_check LIKE STPOI-MENGE.

LOOP AT idoc_data INTO wa_edidd WHERE segnam = 'E1STPOM'.

MOVE wa_edidd-sdata TO v_e1stpom.

CATCH SYSTEM-EXCEPTIONS CONVERSION_ERRORS = 1.

MOVE v_e1stpom-menge_c TO lv_check. " <- Error: CONVT_NO_NUMBER

ENDCATCH.

IF SY-SUBRC = 1.

RAISE EXCEPTION TYPE CX_SY_ARITHMETIC_ERROR .

ENDIF.

CLEAR wa_edidd.

ENDLOOP.

Would you please tell me why and how to correct it? couldn't thank you more.

Best regards.

Frank

1 ACCEPTED SOLUTION

Former Member
0 Kudos
46

Change code as below

DATA: lv_check LIKE STPOI-MENGE.

LOOP AT idoc_data INTO wa_edidd WHERE segnam = 'E1STPOM'.

MOVE wa_edidd-sdata TO v_e1stpom.

CATCH SYSTEM-EXCEPTIONS CONVERSION_ERRORS = 1.

MOVE v_e1stpom-menge_c TO lv_check. " <- Error: CONVT_NO_NUMBER

ENDCATCH.

IF SY-SUBRC = 1.

MESSAGE <Conversion Error>

ENDIF.

CLEAR wa_edidd.

ENDLOOP.

Regards,

Atish

2 REPLIES 2

Former Member
0 Kudos
47

Change code as below

DATA: lv_check LIKE STPOI-MENGE.

LOOP AT idoc_data INTO wa_edidd WHERE segnam = 'E1STPOM'.

MOVE wa_edidd-sdata TO v_e1stpom.

CATCH SYSTEM-EXCEPTIONS CONVERSION_ERRORS = 1.

MOVE v_e1stpom-menge_c TO lv_check. " <- Error: CONVT_NO_NUMBER

ENDCATCH.

IF SY-SUBRC = 1.

MESSAGE <Conversion Error>

ENDIF.

CLEAR wa_edidd.

ENDLOOP.

Regards,

Atish

Former Member
0 Kudos
46

Hi,

You can't use RAISE EXCEPTION TYPE CX_SY_ARITHMETIC_ERROR (new) .

with SYSTEM-EXCEPTION (old). Try displaying error message instead of RAISE.

Cheers.

...Reward if useful.