‎2008 Aug 06 7:27 AM
Hi experts,
I'm new to SE37. I created a function module to provide the remainder and quotient as output, taking dividend and divisor as input. I need to raise exceptions if the dividend/ divisor are negative and if the divisor is zero.
I have no idea how this raising an exception is done. Please provide me the detailed guidence/pointers/examples that would help me learn raising exceptions when an improper input is passed to the function module.
TIA. Points shall be awarded.
Regards,
Kris.
‎2008 Aug 06 7:32 AM
in function module source u hav to write
if <condition>
raise exception.
msg .....
endif.
‎2008 Aug 06 7:32 AM
in function module source u hav to write
if <condition>
raise exception.
msg .....
endif.
‎2008 Aug 06 7:33 AM
‎2008 Aug 06 7:35 AM
‎2008 Aug 06 7:38 AM
Hello,
Prior to this you have to add these exceptions to "Exceptions" tab in SE37.
IF I_DIVISOR CA '-'.
RAISE divisor_negative.
ELSEIF I_DIVIDEND CA '-'.
RAISE dividend_negative.
ELSEIF I_DIVISOR = 0.
RAISE divisor_zero.
ENDIF.
BR,
Suhas
‎2008 Aug 06 7:40 AM
Hi Kris,
In Exception tab add exceptions .
Invalid_divisor
Invalid_dividend
And in Source code add the following code.
If wf_div <= 0 . "iF DIVISOR IS less than or equal to 0
MESSAGE e145(12) RAISING invalid_divisor.
Endif.
If wf_divd < 0.
MESSAGE e145(12) RAISING invalid_dividend.
Endif.
Regards,
Sachin M M
‎2008 Aug 06 7:41 AM