Application Development and Automation 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: 
Read only

Trigger event on Table Update

Former Member
0 Likes
6,927

Hi,

I want to trigger some event/program whenever a particular table is updated.

Is it possible to create triggers on SAP tables at database level like we do in SQL? If yes how?

Thanks

6 REPLIES 6
Read only

Former Member
0 Likes
2,902

Hi,

One way of achieving this is to create & trigger a workflow event whenever there is any change to the particular table,

Rgds,

Read only

0 Likes
2,902

Hi Sailatha,

How would I trigger a workflow event whenever the table is updated?

Read only

Former Member
0 Likes
2,902

Hi Darshil,

<b>SET_REGISTERED_EVENTS</b> You can use this method to handle system events triggered during appointment processing in accordance with the appointment type.

Check out the links to know more abt events.

http://help.sap.com/saphelp_erp2005/helpdata/en/9f/db9a1435c111d1829f0000e829fbfe/frameset.htm

Hope this helps u,

Regards,

Nagarajan.

Read only

Former Member
0 Likes
2,902

You could use a workflow ( a simple single step task would do in this situation ).

Basically the procedure would be to trigger an event whent the table is updated. This event would be the "Triggering Event" for the workflow task which would respond every time the table was updated.

If the table is an SAP table check the technical settings on the table to make sure the "log changes" checkbox is selected. If it is you can link your event to the change document that is written when that table is changed. The change document would raise the event, the event would trigger the workflow task and the task would do whatever work you need done.

If the table is a custom table you can skip the change document. Find the custom code that updates the table and use one of the "SAP_WAPI......" function modules to create the event manually which will trigger the workflow task (Make sure not to create the event until the database has been successfully updated)

Still another method would be to read the change log tables CDHDR and CDPOS with a periodic job looking for the objects you want to monitor and then execute your code when and if you find changed recorded. This would avoid a workflow but it would not be a "real time" process and those tables get pretty big in a production environment. Still, it is a simply way to do it if real time is not required and you want to avoid more complex development.

Hope this helps.

Brent

Read only

Former Member
0 Likes
2,902

Using table maintenance generator, you can create events for different level of databases like database update,before inserting record etc. The menu path for this is , from se11 transation click utilities - > tablemaintenance generator(transaction : se55). From the table meaintenance generator menu click

1. Environment->modifications->events.

2. click on create new entries button.

Select the new event and assign a new perform name.

Press enter and click the editor button which will lead you to ABAP editor.

You can raise the registered events using the function module BP_EVENT_RAISE. The events have to be registered using transaction code SM62. You can code any valid abap statements in the perform.

Hope this helps. Please award appropriately if helpful.

Read only

0 Likes
2,902

Please close the post if the issue is resolved and award the points appropriately.

Thanks.