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: 

Table Maintenance Generator - How to check which column changed?

0 Kudos

Hello All,

When in SM30 using Table Maintenance Generator, I have an event which fires (01 - Before saving data to database) when the user clicks the Save button. When this event fires I can check what <action> occured 'U' - Update, 'N' - New Entry etc.If I'm looking at an internal table called TOTALI can see which row entry in the table was changed with the above <action>. But, how do I check which column was changed? Is there a way to know what the old value in the column was if we can find out which one changed? I looked at EXTRACT and <VIM_TOTAL_STRUC> but none of them contain info like which column changed or what the old values in the changed columns were. How can we achieve this?

Regards,

D.

1 ACCEPTED SOLUTION

Accepted Sandra Rossi's answer.

"Do the SELECT (old values) in event 01, as it's BEFORE save. You compare the old values with TOTAL (new values)."

10 REPLIES 10

Sandra_Rossi
Active Contributor

Usually it's not needed to know the old values. If you want to know which fields have been changed, compare with the values in the database table or view.

jmodaal
Active Contributor
0 Kudos

Hello,

my first thought when reading your question is, that there is also a standard functionality available for logging changes of table data. You can switch it on in SE13 and follow up the changes in SCU3.

0 Kudos

Thanks for your responses.

sandra.rossi , I didn't understand where you're saying the comparison should be made with? Which db table or view?


jmodaal , I'm trying to access the old data in the maintenance generator events of the table specifically 01 - Before saving data to the database. From your suggestion on turning on logging, how would that work in terms of checking which value changed in the column?


Regards,

D.

Sandra_Rossi
Active Contributor
0 Kudos

Your table maintenance dialog is for maintaining a database table (or view), right? Till you save your changes, the database table still contains the old values.

0 Kudos

sandra.rossi , that is correct "till you save your changes". But the event 01 only fires after the user clicks the Save button. When that happens, the FS <vim_struc_total>, <vim_extract_struc>, <vim_cextract> all contain the new values. Is there any structure/internal table where I can see the old values once the event fires?

Regards,

D

Sandra_Rossi
Active Contributor
0 Kudos

It's not what I'm saying. I'm saying that if you do SELECT * FROM table, then you get the values before they are updated by SAP.

0 Kudos

sandra.rossi , I understood what you meant, but what I'm saying is that when and where do I do this "select *"? Is there some sort of pre-event in the table maintenance generator that I can query the table and store those old values in an internal table ready to be used by event 01 when it fires? Because once events 01 fires the values have already changed.How do you share internal tables between events if there is such an event?

Sandra_Rossi
Active Contributor

Do the SELECT (old values) in event 01, as it's BEFORE save. You compare the old values with TOTAL (new values). Maybe I didn't get what you're trying to do, sorry about that.

Thanks sandra.rossi, I made it work for my requirement with your suggestion.

Accepted Sandra Rossi's answer.

"Do the SELECT (old values) in event 01, as it's BEFORE save. You compare the old values with TOTAL (new values)."