Is it possible to retrieve the old or original values for a table when it has been changed, but not yet committed, in the current LUW?
I'm implementing a BAdI that's supposed to be used to raise messages based on changes performed to an object, but SAP doesn't actually provide the original object data in the BAdI. Trying to read the data with SELECT
statements doesn't work as the pending changes have already been applied at that point, just not committed.
If I debug the code I can see the old values just fine in SE16
but it seems like the uncommitted changed values are being returned by any SELECTs
I perform in this BAdI.
Is there any way to read this original data?
Database LUW also known as DB LUW, each dialog step has its own DB LUW that is used to ensure data consistency. SAP LUW consists of several dialog steps and all the changes to database are written in a single DB LUW. We must note that the database changes are always written in the final database LUW.
A database LUW (also called a database transaction) is a non-separable sequence of database operations that ends in a database commit. The database LUW is either executed completely by the database system, or not at all.
A logical unit consisting of dialog steps, whose changes are written to the database in a single database LUW is called an SAPLUW. Unlike a database LUW, an SAP LUW can span multiple dialog steps, and be executed using a series of different work processes.
A database LUW is the mechanism used by the database to ensure that its data is always consistent. An SAP LUW is a logical unit consisting of dialog steps, whose changes are written to the database in a single database LUW. An SAP transaction is an ABAP application program that you start using a transaction code.
The reading of a table which was updated previously, during the same Database LUW, will always return the updated values. So, it's at least required to read the table from another Database LUW.
The isolation level used by default depends on the type of database you are using. For HANA and Oracle, the "committed read" is the default, but other databases use the "uncommitted read" by default.
If you don't use HANA/Oracle, you may switch temporarily to the "committed read" isolation level by calling the function module DB_SET_ISOLATION_LEVEL.
Then, you can read the table from another Database LUW by using a service connection (prefixed R/3*), for instance: SELECT ... FROM yourtable ... CONNECTION ('R/3*temp') ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With