Skip to Content
0

Raise exception in sap workflow

Nov 20, 2017 at 09:14 AM

149

avatar image
Former Member

Hi,

I have a requirement in one of workflow step I am doing some sales order updates when update fails am using Raise statement like 'Raise Order locked'. i did debug my code is working and exception is triggering.

But when i see work item error log error says 'Person doesn't exist 1130016 P'.

1. why this error message is coming

2. why exception details are not displaying which i have raised

3. work item is getting fail but some of updates are getting save in database. I dont want to save the changes in database if any error occur.

Please suggest.

Thanks.

10 |10000 characters needed characters left characters exceeded

How are you:

Performing the update, catching the failure, raising the exception? And how is it handled?

0
Former Member
Mike Pokraka

In step, am using oo method. I have created exception(mail_not_sent) for the method in se24.

eg:

method step2.

------

update ztable from lt_tab

lf lv_update is good.

try

send email(importing ev_return = lv_return )

if lv_return = 4.

Raise Mail_Not_sent.

endif.

endtry.

endif.

endmethod.

I am doing Sales order update then sending email. if I get any exception while sending email I want to fail the work item and Sales Order changes should not save in the database.

Let me know if it is not clear.

Thanks, Awaiting response.

0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Mike Pokraka Nov 21, 2017 at 06:59 AM
1

There's still a lot of guessing with the pseudocode you provide, but from what I can see this is a straightforward ABAP issue. Please call it from a report and get it to work, then you'll be fin in WF.

A couple of hints:

- Use OO exceptions,

- If you're doing this in WF, I would separate distinct business operations. So posting and sending an email would be separate steps, this makes much clearer and is easier to troubleshoot.

- Regarding saving, you say you're updating a sales order but post pseudocode that your're updating a Z table, so we have no idea what you're really doing. There is no transaction or rollback, so updates are immediate.

Show 4 Share
10 |10000 characters needed characters left characters exceeded
Former Member

-pseudocode I gave to clear the requirement, we have approval process workflow. Report is not an option to us.

-I am using oo exception only. If I raise exception 'Raise Order locked' work item is getting fail but error I see 'Person does not exist ****'.

-Separate steps I cant use, I already moved my workflow to production they do not want do so many changes. Only some meaningful exception they want me to add.

-I am updating sales order only just to make clear pseudocode code I just put z table.

But still I did not get my answer.

Thanks.

0

Surely as a developer you should understand the importance of being precise?

Pseudocode is OK for a logic issue, but not for a technical problem. When describing an exception problem, telling us the correct exception type is vital. Writing about classic exception when you're really raising an OO exception doesn't help anyone to identify your problem and just wastes time of those who are trying to help you. The same goes for writing table update instead of the bit that you say isn't working.

2
Former Member

Writing about classic exception when you're really raising an OO exception doesn't help anyone to identify your problem and just wastes time of those who are trying to help you

Ok, If I am not using the right approach what is the correct process to follow. Because I want to fail workflow based on my validations if workflow fails to understand others I need to add meaningful message to workflow log.

Please Advice.

0
Former Member

I was trying to follow this.

https://blogs.sap.com/2013/04/25/use-exceptions-in-abap-oo-workflow-with-custom-text/

In the oo method added the exception CX_BO_TEMPORARY and in the method coding if my validation fails then I put the code like below.

RAISE EXCEPTION TYPE CX_BO_TEMPORARY EXPORTING textID = '002342DFG56FD98WKREW923S323'.

but I am getting warning messages as below. Please let me know am I following right process.

Old exceptions and class-based exceptions cannot be used at the same time.

The exception CX_BO_TEMPORARY is neither caught nor is it declared in the RAISING clause of "MEHOD_NAME****".

Awaiting for your response.

0