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

error After SAVE method, COMMIT WORK or ROLLBACK WORK must be executed

Former Member
0 Likes
3,754

Hi Experts,

I am doing the migration program for the service Order Create using the BAPI 'BAPI_ALM_ORDER_MAINTAIN'. After the BAPI i am calling the FM

'ALM_ME_COMMIT_OR_ROLLBACK' it will commit or Rollback bassed on the Return table what i am getting from the BAPI.

This was working fine. But when i run it in the Bulk order i mean 700 service order some orders i am getting success message. But few orders like 50 orders i am getting the below error message.

"After SAVE method, COMMIT WORK or ROLLBACK WORK must be executed".

when i refer the FM 'ALM_ME_COMMIT_OR_ROLLBACK' they have used bapi_transaction_commit statement and wait also.

But i dont know why i am getting the error message. can you please adivce

Thanks,

Dhina..

1 ACCEPTED SOLUTION
5 REPLIES 5
Read only

0 Likes
2,254

Hi Kesavadas,

Yeah i refered the link.

Function module BAPI_ALM_ORDER_MAINTAIN was called with the SAVE method. Then the function module was called again without triggering update first.

So you want me to put wait statement after the FM 'ALM_ME_COMMIT_OR_ROLLBACK' ?

Thanks,

Dhina..

Read only

0 Likes
2,254

"After the call of BAPI_ALM_ORDER_MAINTAIN with the SAVE method, the update must be triggered or cancelled. A new call is not possible beforehand."

It says  a commit work or rollback work has to triggered after each entry.

or

"If you want to update several calls of BAPI_ALM_ORDER_MAINTAIN together, you can only use the SAVE method for the last call of BAPI_ALM_ORDER_MAINTAIN. All other calls must use the DIALOG method."

In your case, we have to use the DIALOG method( for example change ) for the entries starting from one and use SAVE method in the last entry while passing to parameter IT_METHODS like for example:

  ls_method-refnumber = 1.

  ls_method-objecttype = 'OPERATION'.

  ls_method-method = 'CHANGE'.

  ls_method-objectkey = '12345'.

  append ls_method to lt_methods.

  clear ls_method.

  ls_method-refnumber = 1.

  ls_method-method = 'SAVE'.

  ls_method-objectkey = '12345'.

  append ls_method to lt_methods.

Read only

Former Member
0 Likes
2,254

Hi ,

You are saying Your Function module is using commit and wait means when you are running bulk upation it will wait for all the records has to process first at the last it will do commit.

better you can use COMMIT WORK and ROLLBACK With out WAIT after your BAPI function call.

Thanks

Mani

Read only

former_member570788
Discoverer
0 Likes
2,254

For anyone who is having this problem check if you have 'uncommited' bapi before. In my case I had a bapi which was not commited and after solving it there was no error