‎2007 Dec 17 4:04 AM
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
‎2007 Dec 17 4:18 AM
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.
‎2007 Dec 17 4:23 AM
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