cancel
Showing results for 
Search instead for 
Did you mean: 

Using an on update or insert trigger on a SAP table

laurie_mcginley
Participant
0 Kudos

Hi all,

A question for you regarding using a database trigger in and SAP system.

We are needing to export data for our datawarehouse. Currently we export all the data. That data is getting quite large tho and time is becoming an issue.

One suggestion has been to add a custome field to an existing SAP table to hold a flag to indicate the record has changed but not been extracted. Thenput a trigger on the table in question so that the new field is updated upon update or insert of the record. Then when the extract runs, it will only extract those records with the flag set, then reset the flag.

we are using ERP 6 and SQL Server 2005 (or soon to as we will be upgrading next month).

Any suggestions regarding triggers? Or other options for flagging changed records in large table so we don't have to extract all records every time?

Thanks

Laurie

Edited by: Laurie McGinley on Oct 27, 2008 10:51 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Why use a trigger? Why don't you modify the ABAP program executing the insert or update by adding the new field?

Non SAP objects in your DB could cause problems, e.g. during an upgrade, because they are not expected to be there. That is bascially no problem if you know what you are doing but it is not supported by SAP!

It's up to you

Sven

laurie_mcginley
Participant
0 Kudos

Good point. I come at this from a background as a DBA and am new to ABAP so hadn't considered that. Can you elaborate a little more as to what/where I should look to modify the program(s) when a record is updated or added? Specifically I'm looking at the BSEG cluster and FAGLFLEXA, perhaps BKPF tables

Thanks

Laurie

lbreddemann
Active Contributor
0 Kudos

Hi Laurie,

just really shouldn't consider to put triggers into your application.

The problem here is the very nature of triggers to do things 'in the background'.

If you have problems due to the trigger, you won't see it anywhere in the SAP environment.

In a while you probably forget about the trigger at all and then nobody can see, what is happening to the database, just because something is changed "in the background".

Besides that you don't get support for this from SAP, you will make your life a lot harder.

Tabledefinitions may change - your trigger might break.

Put application logic where it belongs - to the application layer!

regards,

Lars

Former Member
0 Kudos

It's not that simple. SAP provides a mechanism to create change pointers especially for this case. Have a look at view BDCPV (Tabs BDCPS, BDCP). There is a function module (have a look at SE37 with 'change_pointers*') that you have to call when inserting/upadeting a record on your tables. This way you can centrally manage all change pointers. SAP also provides other function modules to read and evaluate those change pointers so that you can use them for whatever purpose.

If you have more detailed questions on this, please have a look at the ABAP forum.

Sven