Application Development 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: 

HOW TO RAISE EXCEPTION IN FUNCTION MODULE !

Former Member
0 Kudos

I have created a function module....where i want to raise some error message when some wrong data will be inputed

what is the syntax ? Please tell me the syntax .

1 ACCEPTED SOLUTION

Former Member

hi you can do like this:

in exception tab of FM write exceptions you want to raise.

e.g. incorrect_input.

now in code write

if input not correct (write your validation condition here)

raise incorrect_input.

endif.

reward if useful.

5 REPLIES 5

Former Member
0 Kudos

hi,

do this way ..


raise invalid_input. 

Regards,

Santosh

Former Member
0 Kudos

You define your exceptions in one of the tabs in SE37.

Say you create one

BAD_DATA

when you want to return this error

RAISE BAD_DATA.

Function exits with sy-subrc = to whatever was assigned during the definition.

Former Member
0 Kudos

Hi,

1. Declare the exceptions in the exception tab.

2. Check the necessary condition in the code. If not satisfied,

RAISE <exception> ---> This should be declared in the Exception tab of the FM.

Thanks and Regards,

Lakshmi.

Former Member

hi you can do like this:

in exception tab of FM write exceptions you want to raise.

e.g. incorrect_input.

now in code write

if input not correct (write your validation condition here)

raise incorrect_input.

endif.

reward if useful.

Former Member
0 Kudos

Not a bad solution, but it will lead to dump.

If you want to regain control returning to the code part calling your FM, then you should use

MESSAGE '' TYPE 'I' RAISING error_type.