Application Development 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: 

Rollback work is not working after calling function in user exit

Former Member
0 Kudos

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

former_member182550
Active Contributor

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.

0 Kudos

That's how it is and can be found here

Thanks Horst

0 Kudos

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.

0 Kudos

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

SuhaSaha
Advisor
Advisor

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

Former Member
0 Kudos

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

chaouki_akir
Contributor
0 Kudos

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.

former_member182550
Active Contributor
0 Kudos

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.

kiran_k8
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

@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 .