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: 

Trigger on a standard table

Former Member
0 Kudos

Dear All,

Can I create a trigger for a standard SAP Table (say TCJ1T).

If so, how do I go about it?

Regards,

Ashwin Bhat

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

There is no trigger concept in SAP like Oracle

What for you need this trigger on that Database table?

Means whay should happen when you trigger ?

Reward points for useful Answers

Regards

Anji

6 REPLIES 6

Former Member
0 Kudos

Hi

There is no trigger concept in SAP like Oracle

What for you need this trigger on that Database table?

Means whay should happen when you trigger ?

Reward points for useful Answers

Regards

Anji

0 Kudos

Hi,

SAP does not provide any option of creating database trigger's on the Database tables declared using Data Dictionary.

But yo ucan go and create one in the underlying database if you know the table in the underlying database.

Regards,

Sesh

uwe_schieferstein
Active Contributor
0 Kudos

Hello Ashwin

If "trigger" means any changes of the DB table then there is the option <b>Log data changes</b> in the <b>technical settings</b> of a table.

On our ECC 5.0 system the data changes on table TCJ1T are logged, meaning that the flag is marked.

However, logging requires that the system profile parameters are set accordingly.

This is what the F1 help says:

 DE DDPROTOCOL
 ____________________________________________________
 Short Text
     Log data changes
 Definition
     The logging flag defines whether changes to the data records of a table
     should be logged. If logging is activated, every change (with UPDATE,
     DELETE) to an existing data record by a user or an application program
     is recorded in a log table in the database.
     Note: Activating logging slows down accesses that change the table.
     First of all, a record must be written in the log table for each change.
     Secondly, many users access this log table in parallel. This could cause
     lock situations even though the users are working with different
     application tables.
 Dependencies
     Logging only takes place if parameter rec/client in the system profile
     is set correctly. Setting the flag on its own does not cause the table
     changes to be logged.
     The existing logs can be displayed with Transaction Table history
     (SCU3).

I actually do not know but believe that it is possible to raise "events" in the system resulting from Log data changes.

Regards

Uwe

ashwin_bhat
Participant
0 Kudos

Hi everyone,

Thanks for your replies.

The reason I want to use triggers is to read the data whenever a change is made to the SAP Standard tables ( I have 10 such tabs).

I know of the logging option and have also written a program to read the values from DBTABLOG Table. The issue is that the field "logdata" in DBTABLOG stores the old data in case of an update. I have to read the new value from database.

I was wondering if...by using a trigger we can read this data and push it into another table in a specific format. I know this method sounds very lame ( I am trying to create another log table ) but I am running out of options.

Regards,

Ashwin

0 Kudos

Hello Ashwin

Are you aware of <b>change objects</b> and the corresponding tables <b>CDHDR </b>and <b>CDPOS</b>?

If a change object is available for your table (or you create your own) then virtually every change of the table records can be monitored. For example, VERKBELEG is the change object for table VBAK.

Transaction <b>SCDO </b>is used to display change documents.

Regards

Uwe

ashwin_bhat
Participant
0 Kudos

Even if we create a trigger using the Underlying DB table, will this trigger work if changes are made to the Table using table maintenance SM31,