cancel
Showing results for 
Search instead for 
Did you mean: 

Exception Raising in Function Module

Former Member
0 Kudos

Hi,

I am having a custom function module that calls a standard function module. Custom function module has following exception defined: manufacture unknown.

Standard function module has enhancement sections that I implement. For a defined condition I have to raise an exception and return from the function module. However, the exception is not defined in function module.

Standard exception OTHERS is available. Is it possible to raise OTHERS exception from the code? I have tried statement Raise OTHERS. But it has syntax errors.

Regards,

Bhavish Bhatia

Accepted Solutions (0)

Answers (3)

Answers (3)

iaki_vila
Active Contributor
0 Kudos

Hi Bhavish,

I dont like so much to raise exception and if you will go to use it in a third-party application or a middleware like PI i'd rather to catch the exception in abap code and to create an export parameter, EX_Result TYPE BAPIRETURN, then inside ZRFC to take the sy-subrc and/or customize my own messages.

Regards.

Former Member
0 Kudos

Hi,

If you raise an exception not defined at exception's tab, sy-subrc will be returned with the number of exception OTHERS.

Just with the sentece:

RAISE ZEXCEPTION. (Assuming that ZEXCEPTION is not included at exception's tab).

Regards,

Pablo.

Former Member
0 Kudos

Hi,

Please define your own exception (e.g. BHAVISH) and raise it:

RAISE BHAVISH.

Regards,

Wojciech

Former Member
0 Kudos

hi,

In the exception tab of the Function module, just create a exception.

and raise this exception in the code as written above.

Regards

Vijaya

Former Member
0 Kudos

Hi,

I am aware of this option. However, it is a standard function module and I cannot create the exception in it. I am modifying one of the enhancement sections provided in it.

I would appreciate if you could suggest me some other possible solution.

Regards,

Bhavish Bhatia

Former Member
0 Kudos

Hi,

Maybe create a wrapper of this standard function module.

Regards,

Wojciech