03-16-2011 5:40 AM
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
03-17-2011 9:42 AM
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
03-17-2011 3:40 PM
hi,
ROLLBACK is not required.
Also don't call FM BAPI_TRANSACTION_COMMIT or COMMIT WORK .
03-17-2011 3:54 PM
Hi Niveditha,
in case of BAPI_MATERIAL_SAVEDATA call BAPI_TRANSACTION_ROLLBACK, if executed in "Test mode".
Regards
REA
04-28-2011 3:32 PM
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
04-28-2011 7:05 PM
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