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

Exceptions in function modules.

Former Member
0 Likes
851

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
816

in function module source u hav to write

if <condition>

raise exception.

msg .....

endif.

6 REPLIES 6
Read only

Former Member
0 Likes
817

in function module source u hav to write

if <condition>

raise exception.

msg .....

endif.

Read only

Former Member
0 Likes
815

first create exception in exception tab

Read only

Former Member
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
815

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

Read only

sachin_mathapati
Contributor
0 Likes
815

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

Read only

Former Member
0 Likes
815

hi

refer to this link

Cheers

Snehi