2008 Nov 05 11:08 AM
hai abapers,
topic : Division.
example : a type p decimals 3,
b = 0
c = a / b.
at this time execution , run time error comes .
how will avoid this error.
hai abapers,
topic : Division.
example : a type p decimals 3,
b = 0
c = a / b.
at this time execution , run time error comes .
how will avoid this error.
2008 Nov 05 11:10 AM
example : a type p decimals 3,
b = 0
CATCH SYSTEM-EXCEPTIONS arithmetic_errors = 4
OTHERS = 8.
c = a / b.
ENDCATCH.
2008 Nov 05 11:12 AM
@ Fun.
Dont Divide.
@ Answer
See F1 help or search the forum for TRY....CATCH....
You can avoid by handling exceptions.
Regards
Karthik D
2008 Nov 05 11:12 AM
Any number divided by zero will result infinity. so avoid dividing by zero. Perform calculation only when the denominator is not zero.
2008 Nov 05 11:13 AM
you can also do:
IF b NE 0.
c = a / b .
ELSE.
WRITE : 'Only Chuck Norris is able to divide by zero!'.
ENDIF.
2008 Nov 05 11:15 AM
2008 Nov 05 11:15 AM
2008 Nov 05 11:24 AM
>
> you can also do:
>
>
IF b NE 0. > c = a / b . > ELSE. > WRITE : 'Only Chuck Norris is able to divide by zero!'. > ENDIF.
Then how the code would be if Chuck Norris write the program to divide by 0
Regards
Karthik D
2008 Nov 05 11:28 AM
Then we should have the same statement written in the Dump Analysis. LOL!!!!!!!!!!!
2008 Nov 05 11:15 AM
Hi Raj,
As we know anything divided by zero is always zero which throws exception in ABAP to avoid that situation
in ABAP check the value of b if not 0 then divide else avoid dividing.
Regards,
Venky
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |