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: 

Regarding function module

former_member189596
Active Participant
0 Kudos

Hi all,

i have requirement to raise exception in function module.

in this function module , we have total two EXIT statements.

i need to raise exception for that.

is there any point to know solution .

Thanks in advance,

Regards,

Bhaskar

5 REPLIES 5

Former Member
0 Kudos

Hi Bhaskar,

What is the issue.

You can just use RAISE EXCEPTION.

Regards,

Atish

0 Kudos

Hi,

I enter two exptection in EXPECTIONS tab.

if i declare statement with after EXIT statement.

But its showing message like "<b>EXCEPTION" is not defined as an exception in the function module. </b>.

can u give navigational steps if cretation exptection .

Thanks in advance,

Regards,

Bhaskar

h_senden2
Active Contributor
0 Kudos

define 2 exceptions.

replace EXIT statement by RAISE exception1. and the others by RAISE exception2.

regards,

Hans

Former Member
0 Kudos

Hi Bhaskar,

Raise the excepton by using the bellow syntax, if the FM contain exception perameters. Otherwise include the exceptions and populate those.

RAISE EXCEPTION { {TYPE cx_class [EXPORTING p1 = a1 p2 = a2 ...]}

| oref }.

Effect

This statement interrupts the execution of the current statement block and triggers a class-based exception. It can appear at every stage of a processing block.

If the addition TYPE is specified, an exception object of the exception class cx_class is created when the exception is triggered. After TYPE, every exception class cx_class visible at this point can be specified. With the addition EXPORTING, you can assign appropriate actual parameters to the input parameters of the instance constructor using the same syntax as with CREATE OBJECT.

If oref is specified, no new exception object is created during the trigger. For oref, an object reference variable must be specified which refers to an already existing exception object.

The statement RAISE EXCEPTION rules out the simultaneous use of the statement CATCHSYSTEM-EXCEPTIONS to handle catchable runtime errors, and the statements RAISE or MESSAGE RAISING to trigger non class-based exceptions in function modules and methods in the current processing block.

Note

When oref is specified, you can use an exception object instanced via CREATE OBJECT, or you can re-trigger an exception that had already been caught during the exception handling.

Former Member
0 Kudos

Hi Bhaskar,

Declare some expceptions in the Exceptions tab of the function module.

Before Exit command is getting executed, raise exception with one of the exception you have maintained in the function module.

<b>Reward for helpful answers</b>

Satish