‎2010 Mar 20 8:57 PM
Dear Experts,
I have a custom table(Ztable) on which I need to trigger a specific program everytime a record is inserted into this database table.
This table might get updated thru various programs around 50 programs, so I cannot go to each program and make a change. So can some one suggest me a way, such that everytime
a DB table gets updated I want the system to generate some kind of event/ Idoc/ Signal informing about the
record being created with the record data.
In short I want a functionality similar to that of
Triggers in SQL.
Thanks
-Amit
‎2010 Mar 20 9:49 PM
Hi Amit,
I'm pretty sure that there's no such thing in SAP as database triggers, which you could use to retrofit your application to suit your needs (essentially not required, because you'd do that differently in SAP).
Basically I'd recommend refactoring your programs - I know it's a pain, but if the design was poor in the first place, it's the right thing to do. I don't think you want to switch your coding to database level as indicated in a previous posting.
If the design of the applications would've been right in the first place, you would have some kind of update module (e.g. an update function) that all programs call for updating your custom table. With this kind of approach your requirement is simple to implement, because then you'd only need to update the coding in the update module. That's why proper modularization of programs is so important.
Anyhow, probably you know all that and are just like most of us in the awkward position of implementing new requirements on existing, organically grown, poorly designed coding with the common hammer argument of minimal costs. However, I personally think that it's better to bite the bullet at some time, because certain refactorings are clearly beneficial as they will simplify program support and maintenance.
Cheers, harald
‎2010 Mar 20 9:22 PM
‎2010 Mar 20 9:38 PM
Hi Amit,
create a class mit static method to create event. Use RPR_ABAP_SOURCE_SCAN to find the 50 or so (Z-) programs using your table. insert the line with the method call at all update/insert for the Z table.
If you don't wait, this is finished until noon.
Regards,
Clemens
‎2010 Mar 20 9:49 PM
Hi Amit,
I'm pretty sure that there's no such thing in SAP as database triggers, which you could use to retrofit your application to suit your needs (essentially not required, because you'd do that differently in SAP).
Basically I'd recommend refactoring your programs - I know it's a pain, but if the design was poor in the first place, it's the right thing to do. I don't think you want to switch your coding to database level as indicated in a previous posting.
If the design of the applications would've been right in the first place, you would have some kind of update module (e.g. an update function) that all programs call for updating your custom table. With this kind of approach your requirement is simple to implement, because then you'd only need to update the coding in the update module. That's why proper modularization of programs is so important.
Anyhow, probably you know all that and are just like most of us in the awkward position of implementing new requirements on existing, organically grown, poorly designed coding with the common hammer argument of minimal costs. However, I personally think that it's better to bite the bullet at some time, because certain refactorings are clearly beneficial as they will simplify program support and maintenance.
Cheers, harald