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

Check function module called with an event

Former Member
0 Likes
1,255

Hello all,

I have an event defined in SWETYPV.

In that event I have a check function module.

The check function module has 5 different cases where it can raise an exception thus stopping the workflow after it from starting.

I have cases where an exception was raised during the course of normal production work, causing the workflow after it to not start, but I cannot tell which exception was raised.

When I raise the event myself through SWUE and debug the code using the same data - the code works fine without raising an exception.

Is there a way in the function module to return which exception was raised and placed in the event log so that I can tell which part of code is failing?

Or how is the best way to tell which excpetion was raised in a check function module?

Thanks.

Scott Overmeyer

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
988

See some standard check function module and check how the exceptions are raised or captured.

You have a better chance of getting quick answers from the where the workflow questions are discussed.

Srinivas

3 REPLIES 3
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
988

Usually when you define exceptions in your function modules, you handle this exceptions by the calling program. for example. If you have 3 exceptions in your function module, when you call the function module, you assign a value to the exception, which when the exception is raised, the function module ends and SY-SUBRC is set to the value that you have assign to the exception.

Lets say you have the following function, you are calling it this way, notice that there are 3 exceptions for this function module. Let's say that ERROR2 was raised in the function module. Now SY-SUBRC is set to 2. Now you know which exception was raised and you can handle it accordingly.

Call function 'ZTEST'
    exceptions
        error1 = 1
        error2 = 2
        error3 = 3.

Welcome to SDN. Please make sure to award points for helpful answers and mark you post as solved when your question has been anwsered completely. thanks.

Regards,

Rich Heilman

Read only

0 Likes
988

As you can tell - this is my first time posting to this forum.

Hopefully I am doing this correctly.

My function module does have exceptions like you described.

However, when an event is raised - and I have the event logs turned on - the only thing I get in the event log is the message 'Check FM ends with exception'. It does not tell me what sy-subrc is.

When I raise the event by hand and debug it - I don't get any exception. Something is happening when it is raised in the normal course of business - and I'm not sure how to capture sy-subrc in the event log so I can tell which exception occured.

It sounds like this is not an abap question but a workflow question from reading the other post.

Maybe it would be better if I posted it there.

Thanks for the help!

Scott

Read only

Former Member
0 Likes
989

See some standard check function module and check how the exceptions are raised or captured.

You have a better chance of getting quick answers from the where the workflow questions are discussed.

Srinivas