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 system-exceptions arithmetic_errors = 5. what this statement does

Former Member
0 Likes
2,222

loop at rt_fieldcat assigning <ls_fieldcat>

where not do_sum is initial

and not no_out eq 'X'

and tabname eq r_tabname

and tech is initial.

catch system-exceptions arithmetic_errors = 5.

assign component <ls_fieldcat>-fieldname

of structure rt_outtab to <sum>.

assign local copy of <sum> to <sumcopy>.

clear <sumcopy>.

in the above code, the statement

"catch system-exceptions arithmetic_errors = 5".

what it is use of this statement

2 REPLIES 2
Read only

Former Member
0 Likes
1,053

Hi

catch system-exceptions arithmetic_errors = 5.

.................

endcatch.

if the code in the catch and endcatch block raises any arithmetic exceptions then it will make the sy-subrc value as 5 and avoids the dump(run time error)

rgds,

bharat.

Read only

harimanjesh_an
Active Participant
0 Likes
1,053

Hi jagan,

You can catch catchable runtime errors in the processing block enclosed between the CATCH and ENDCATCH statements.

syntax :

CATCH SYSTEM-EXCEPTIONS except1 = rc1 ... exceptn = rcn.

rc ... rcn must be numeric literals.

You can include a CATCH ... ENDCATCH block anywhere where an IF ... ENDIF block can be included - that is, local to an event, not cross-event

If a runtime error is caught, the current processing block is interrupted, and the system jumps from the ABAP statement where the error occurred to the appropriate ENDCATCH statement - regardless of how many control structure levels (IF, DO, LOOP, SELECT, CATCH!, etc, ...) must be skipped.

You cannot be certain of the content of the fields affected by a statement where an error occurred, after ENDCATCH.

Example :

DATA I TYPE I.

*CONVERSION_ERRORS contains CONVT_NO_NUMBER *

CATCH SYSTEM-EXCEPTIONS CONVERSION_ERRORS = 1.

MOVE 'abc' TO I. " <- Error: CONVT_NO_NUMBER

ENDCATCH.

IF SY-SUBRC = 1.

...

ENDIF.

check this link for further reference :

http://help.sap.com/saphelp_nw04/helpdata/en/cf/f2bbce142c11d3b93a0000e8353423/frameset.htm

Reward me if useful....

Harimanjesh AN