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

Raising exceptions in function module

Former Member
0 Likes
3,146

I am writing a coding inside the userexit. The call customer function has 'exception' parameters like below:

EXCEPTIONS

IDOC_ERROR = 1

DO_NOT_PROCESS_IDOC = 2

OTHERS = 3.

Now, I want to raise the exception to '1' depending on some conditions. How do I do that? I used to just get the import parameters from the funciton module but never raised exceptiosn before.

please advice.

Thanks

1 ACCEPTED SOLUTION
Read only

ferry_lianto
Active Contributor
0 Likes
867

Hi,

Please try this.


...

IF <your field check>  NE <your condition>
  RAISE IDOC_ERROR.
ENDIF.

OR

SY-SUBRC = '1'.

...

Regards,

Ferry Lianto

6 REPLIES 6
Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
867

Hi

I hope the Function Module will take care for this.

Regards,

Sreeram

Read only

Former Member
0 Likes
867

Hi,

Inside the FM...

Give

RAISE IDOC_ERROR.

Thanks,

Naren

Read only

Former Member
0 Likes
867

after executing the function module it returns sy-subrc value. based on sy-subrc u can write ur exception in ur user exit as message.

Read only

Former Member
0 Likes
867

at the particular condition code for

RAISE IDOC_ERROR or

raise DO_NOT_PROCESS_IDOC .

for eg,

if sy-subrc = 2.

RAISE IDOC_ERROR

endif.

Read only

ferry_lianto
Active Contributor
0 Likes
868

Hi,

Please try this.


...

IF <your field check>  NE <your condition>
  RAISE IDOC_ERROR.
ENDIF.

OR

SY-SUBRC = '1'.

...

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
867

Hi,

IF <condition> .

Raise IDOC_ERROR.

ENDIF.

The IDOC_ERROR must declare in FM Exception tab.

Regards,

Bhaskar