cancel
Showing results for 
Search instead for 
Did you mean: 

Commit within BADI

Former Member
0 Kudos

Hi,

recently I found a solution to modify profit center using a BAPI within the BADI_MATERIAL_CHECK.

This one is the only that let you "interact" with the field PRCTR,but not modify it.

So I used the BAPI.

Obviously I had the necessity to confirm the BAPI using the BAPI_TRANSACTION_COMMIT,but someone told me that this operation cause many problems and then is not permitted.

Is that true ? How can I resolve the problem to modify the profit center ?

Thankx

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Luca,

No, The BAPI_TRANSACTION_COMMIT did not create any problem.

This is the function module which executes external commit when using BAPIs.

BAPI_TRANSACTION_COMMIT is used when you make changes to the SAP database by calling

a BAPI from outside SAP and want to commit the database.

You can check your results with BAPI return structures/tables and if you get proper values then you will do extenal commit with BAPI_TRANSACTION_COMMIT and if you didnt get proper values then you can do extenrnal roll back by using function module BAPI_TRANSACTION_ROLLBACK.

Thanks,

Vinay

Message was edited by:

Vinaykumar G

Former Member
0 Kudos

Hi,

thank you all to replying this post,but I have still some doubts because some of my colleagues told me that a COMMIT WORK (and it's worst with the COMMIT WORK AND WAIT...is that true?) in a process (like MM02 in this case) can confirm in mode irrevocable any update made.

So this can generate some problems and then is not good using this way.

This should be even explained in a Sap note.

Thank you again!

Former Member
0 Kudos

Hi Luca,

The perception you had with COMMIT WORK AND WAIT has wrong.

It executes a database commit and thus closes a logical processing unit or Logical Unit of Work ( LUW ) .

This means that all database changes are made irrevocable and cannot be reversed with ROLLBACK WORK and all database locks are released.

The addition ... AND WAIT makes the program wait until the type V1 updates have been completed.

As an ABAPer, I used these statements COMMIT WORK and BAPI_TRANSACTION_COMMIT and never faced any problems.

Plz mark all helfpful answers and close the thread it the problem is solved.

Thanks,

Vinay

Former Member
0 Kudos

Thanks Vinay,

what I'm trying to explain it's that I'm concerned about using the COMMIT within a BADI in the MM02.

If someone use MM02 through job or whatever,when it reaches the BADI-point,any modification will be confirmed even for those is not request.

Hope this could explain better.

Forgive my diffidence but I read from other forums that is not adviced using commit in these cases.

Regards,

Luca

Former Member
0 Kudos

Hi Luca,

Never say forgive or any kind of things as No one was perfect.

I didnt encounter any problem with these statements yet. Even i face some thing my answer will be different.

Generally you will define BADIs using SE18 and provide their implementations through SE19 transaction codes.

BADIs are of three kinds and one among them is Multiple use BADIs. If you have other implemenations apart form your BADI and one among the other may also trigger. I hope this may be causing even for any modification will be confirmed even for those is not request.

Thanks,

Vinay

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

After calling that BAPI, use the COMMIT WORK. You can use

BAPI_TRANSACTION_COMMIT, there is no problem in it.

It will commit to the database. You can do it.

Pl reward if if helps.

Thanks & Regards

Sadhu Kishore