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

Rollback work is not working after calling function in user exit

Former Member
0 Likes
2,831

Hello Team,

I am doing changes in sales order user exit. Here interesting point is that I call one FM to get some data.

If i don't call FM, then roll back works and delivery is not created.But when I call FM then Rollback does not happen.

I have tried using Rollback work and bapi_transcation_rollback.

Please suggest some hints.

Regards,

Shiv.

11 REPLIES 11
Read only

Former Member
2,331

I seem to remember @Horst_Keller mentioning the fact that there is an implied commit work when a work area is rolled out. I've tried finding this again but no luck. Perhaps Horst can dig it up for you.

Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
2,331

That's how it is and can be found here

Read only

2,331

Thanks Horst

Read only

0 Likes
2,331

Thanks Richard and Horst.

Thanks for sharing link. Reason to use this in userexit_save_document that delivery number is generated which we need to pass to web service.

in userexit_save_document_prepare ,Delivery number is not generated. So please suggest is there any possiblity further.

Read only

0 Likes
2,331

Off the top of my head I would suggest peeking (ie reading but not updating) at the next number in the relevant number range, calling your third party service and if that is not ok abandon the delivery. All of this can be done in save_document_prepare.

Rich

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
2,331

If i don't call FM, then roll back works and delivery is not created.But when I call FM then Rollback does not happen.

Without "relevant" code snippet it is not possible to analyse if any implicit commit is triggered. If you want concrete answers, then post the code snippet.

BR

Suhas

Read only

Former Member
0 Likes
2,331

Code logic follows as

I am in Userexit_save_document where I am doing coding inside one FM. Here Reason to do coding that Delivery number is determined here which we need to send to third party and get the response from there.

So I am calling Webservice FM here and checking if there is error message returns then I need to rollback which means no delivery creation.

Call FM 'ABC'

export = im_request

import = ex_response.

If Ex_response-error is not initial.

rollback work.

endif.

If I comment CALL fm and just do rollback work then delivery is not created. But with FM, delivery is created with rollback work also.

Please suggest.

With regards,

Shiv

I

Read only

chaouki_akir
Contributor
0 Likes
2,331

Hello,

User-Exit "userexit_save_document" is part of what program : SAPMV45A ?

Is it called during transaction VA02 ?

Can you show us a ScreenShot of your code (that is in the user exit) ?

BR.

Read only

Former Member
0 Likes
2,331

You should not be doing a rollback work inside a user exit. Use Save_Document_Prepare Instead and then (I think) issue an 'E' message.

Read only

kiran_k8
Active Contributor
0 Likes
2,331

Shiva,

What is the input and what is the output from the FM through which you calling a webservice ? What else is checked within that FM to determine whether it is a Success or Failure.Based on that, may be you can get more appropriate suggestions relevant to your requirement.

K.Kiran.

Read only

Former Member
0 Likes
2,331

@Richard,

Thanks for your response. We can not do coding in save_document_Prepare as delivery number is not determined yet which we need to send it to third party.

@All, Please suggest if problem of this solution is feasible .