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: 

Eexcuting BAPI_MATERIAL_SAVEDATA without commit

Former Member
0 Kudos

Hi all,

There is data migration program to create material master using BAPI- BAPI_MATERIAL_SAVEDATA where in i have an option called "Test mode". When this option is selected, i am suppose to execute the BAPI without saving the changes in the database. Purpose is just to execute the program for test purpose. Can you please guide me how to go about with this? Should i use a ROLLBACK command after calling the BAPI?

Thank you for your time.

Regards,

Niveditha

5 REPLIES 5

Former Member
0 Kudos

Hi

I hope you will be calling BAPI_TRANSACTION_COMMIT after calling the BAPI_MATERIAL_SAVEDATA.

If Yes, than do not call the BAPI_TRANSACTION_COMMIT if the mode is TEST MODE

Regards

Madhan D

Former Member
0 Kudos

hi,

ROLLBACK is not required.

Also don't call FM BAPI_TRANSACTION_COMMIT or COMMIT WORK .

Former Member
0 Kudos

Hi Niveditha,

in case of BAPI_MATERIAL_SAVEDATA call BAPI_TRANSACTION_ROLLBACK, if executed in "Test mode".

Regards

REA

0 Kudos

Hi,

I could achieve the requirement using the BAPI_TRANSACTION_ROLLBACK command. But this command will work only if BAPI_TRANSACTION_COMMIT has been executed.

Regards,

Niveditha

0 Kudos

If you want to execute the program in test mode, do the following:

1. Call BAPI_MATERIAL_SAVEDATA

2. Call BAPI_TRANSACTION_ROLLBACK

If you want to execute the program in commit mode (i.e. save & commit the data to the database) do the following:

1. Call BAPI_MATERIAL_SAVEDATA

2. Call BAPI_TRANSACTION_COMMIT

You should always use only one of either BAPI_TRANSACTION_COMMIT or BAPI_TRANSACTION_ROLLBACK. This is because once you have committed a BAPI Transaction, it CANNOT be rolled back and once you have rolled back a BAPI Transaction it cannot be comitted.

Edited by: Alex D. C. on Apr 28, 2011 8:05 PM