Managing Triggers and Shadow Tables in SAP ERP on HANA
Question
How do I manually delete triggers, suppress unnecessary re-syncs if no deletes occurred, and clean up shadow tables?
Environment
- Connector: SAP ERP on HANA
- Feature: Triggers for detecting deletes
Answer
The SAP ERP on HANA connector uses triggers to detect deletes on source tables. For each source table, we create a trigger for the AFTER_DELETE
event along with a corresponding shadow (DELETES
) table. When activated, the trigger saves the primary keys of deleted rows into the shadow table. We then read the data from the shadow tables to synchronize deletes with a target destination.
We provide transaction /N/FIVETRAN/TRIGGERS
for manual management of triggers and shadow tables in the source system. Using this transaction, you can:
- View triggers created on source tables
- Check whether re-sync suppression is active
- See the number of records associated with a trigger
- Identify error counts
Deleting triggers
When applying DDL changes to standard tables, SAP requires that no triggers exist for these tables. Fivetran triggers are designed to be managed by SAP, meaning that standard SAP programs can delete these triggers automatically. However, in some processes, SAP requires a user to manually delete the triggers.
You can delete triggers using one of the following methods:
Using transaction /N/FIVETRAN/TRIGGERS
This method provides an interactive UI where you can review triggers before deletion, making it ideal for selective, manual trigger removal. Use this method when:
- The table should no longer be included in the replication process.
- The associated shadow table and Fivetran usage statistics need to be deleted.
- The deletion should be reviewed before execution to prevent unintended removal.
- You are managing individual tables rather than performing a bulk deletion.
Using report /FIVETRAN/TRIGGER_DROP
Use this method when:
- You are removing multiple triggers at once instead of managing them individually.
- The shadow tables should remain intact for historical reference.
- You want to automate the deletion process without manually selecting each table.
- You are running maintenance tasks where triggers need to be refreshed or removed efficiently across multiple tables.
/FIVETRAN/TRIGGER_DROP
is a report designed mainly for SAP administrators to quickly remove triggers from multiple tables. Unlike/N/FIVETRAN/TRIGGERS
, it does not have its own transaction code and must be run through SAP’s standard SE38 transaction. The report is simple to use - it requires only a list of source tables and will remove the associated triggers accordingly.
Deleting triggers using transaction /N/FIVETRAN/TRIGGERS
Log in to your SAP system using your standard authentication method (for example, user ID and password).
In the SAP GUI, enter the transaction code
/N/FIVETRAN/TRIGGERS
in the command field and press Enter. This will open the FIVETRAN SAP ERP on HANA connector Triggers screen.In the Source table name field, enter a single table name or a range of tables to locate the triggers you want to delete. If left empty, the system will display all triggers created by Fivetran.
Click Execute to apply the filter and display the matching triggers.
Choose the table(s) from which you want to drop the triggers and click Delete to initiate trigger removal.
A pop-up dialog will appear confirming the table(s) and trigger(s) selected for deletion. In this example, we are deleting triggers for table
A003
. Click Execute in the pop-up to confirm deletion.
After execution, the table(s) will be removed from the list, confirming that the triggers have been successfully deleted.
Deleting triggers using /FIVETRAN/TRIGGER_DROP report
Log in to your SAP system using your standard authentication method (for example, user ID and password).
In the SAP GUI, enter 'SE38' in the command field and press Enter. This will open the ABAP Editor: Initial Screen, where you can enter and execute reports.
In the Program field, enter the report name:
/FIVETRAN/TRIGGER_DROP
and click Execute to open the report screen.In the Table Name fields, specify a single table or a range of tables to filter the trigger(s) to be deleted (for example, entering 'A*' deletes triggers for all tables whose names start with 'A').
(Optional) Clear the Test mode checkbox:
- When enabled, the report runs in simulation mode, showing which triggers would be deleted without actually deleting them.
- When disabled, the triggers are permanently deleted.
Click the Execute button.
- If Test mode is enabled, review the output before proceeding with live execution.
- If Test mode is disabled, SAP may prompt you for confirmation before deleting the trigger.
After execution, the report will display which triggers were deleted.
Re-creating triggers and suppressing re-sync
If triggers are deleted and later re-created, we detect the time gap during which the triggers were missing. As a result, a re-sync is automatically initiated to account for potentially missed deletes. This re-sync occurs automatically during the next sync after the trigger deletion or re-creation.
However, if you can confirm that no deletes occurred while the triggers were missing, you can suppress the automated re-sync to avoid unnecessary data processing. Follow the steps below to manually recreate triggers and suppress the re-sync.
Log in to your SAP system using your standard authentication method (for example, user ID and password).
In the SAP GUI, enter the transaction code
/N/FIVETRAN/TRIGGERS
in the command field and press Enter. This will open the FIVETRAN SAP ERP on HANA connector Triggers screen.In the Source table name field, enter a single table name or a range of tables to locate the triggers you want to re-create. If left empty, the system will display all triggers created by Fivetran.
Click Mass activity to open the trigger management screen where you can re-create triggers, suppress re-sync, and clear shadow table content.
In the Source table name field, enter a single table name or a range of tables to locate the triggers you want to re-create.
Re-create triggers:
Select the Re-create triggers checkbox to enable trigger re-creation.
By default, we re-create triggers only for source tables that were previously used in the sync process.
If you manually deleted a trigger and its shadow table using the
/N/FIVETRAN/TRIGGERS
transaction, we clear the usage statistics for that table. As a result, the table is no longer recognized as previously used, and triggers will not be automatically re-created via the Mass activity report.To re-create triggers in this case, and to prevent a full re-sync, select the Initialize usage statistics checkbox and provide the Target destination group ID of the connection where the source tables will be used.
If you used
/FIVETRAN/TRIGGER_DROP
to delete triggers, or if triggers were deleted automatically by SAP, usage statistics are preserved. In this case, do not select Initialize usage statistics, and either clear the checkbox or leave the Target destination group ID field empty.If you also need to reset Fivetran’s tracking data, select the Initialize usage statistics checkbox.
If initializing usage statistics, enter the Target destination group ID of your connection where the source tables will be used.
How to find target Destination Group ID
To find the Target destination group ID:
1. Navigate to your connection page in the Fivetran dashboard.
2. Click the destination link at the top.
3. On the Destination Connection Details page, scroll down to the bottom and copy the value of the Destination Group ID field.
Select the Suppress re-sync checkbox to prevent the system from automatically re-syncing data when the triggers are re-created.
Suppressing re-sync is recommended only if you are certain that no deletions occurred during the time the triggers were missing.
(Optional) If you want to remove old shadow table data, select the Clear shadow table content checkbox.
- In the Cutover date field, enter the date before which shadow table records should be deleted.
Click Execute to apply the changes.
Cleaning shadow table content
When delete operations occur on a source table, we capture the primary key values of the deleted records. We store these values in a shadow table and later use them during sync.
Over time, the shadow table content accumulates, and it needs to be periodically cleaned to maintain performance and data integrity. You can clean shadow tables using one of the following methods:
Using transaction /N/FIVETRAN/TRIGGERS: This method is recommended for cleaning the shadow table of a single source table. It provides visibility into the shadow table contents, allowing you to review and delete specific records based on defined criteria.
Using the Mass activity report: for bulk cleanup across multiple tables. This method is more efficient when cleaning shadow tables for multiple tables at once.
Cleaning shadow tables using transaction /N/FIVETRAN/TRIGGERS
Log in to your SAP system using your standard authentication method (for example, user ID and password).
In the SAP GUI, enter the transaction code
/N/FIVETRAN/TRIGGERS
in the command field and press Enter. This will open the FIVETRAN SAP ERP on HANA connector Triggers screen.In the Source table name field, enter a single table name or a range of tables to locate the triggers you need. If left empty, the system will display all triggers created by Fivetran.
Select the table from the list for which you want to delete the shadow table entries.
Click Show Data to display the contents of the shadow table.
Click Clear entries to specify the deletion criteria (e.g., date, time).
Click Close to exit the screen after completing the cleanup.
Cleaning shadow tables using the Mass activity report
Log in to your SAP system using your standard authentication method (for example, user ID and password).
In the SAP GUI, enter
/N/FIVETRAN/TRIGGERS
in the command field and press Enter. This will open the FIVETRAN SAP ERP on HANA connector Triggers screen.In the Source table name field, enter a single table name or a range of tables to locate the triggers you need. If left empty, the system will display all triggers created by Fivetran.
Click Mass activity to open the trigger management screen, where you can clear the shadow table content.
In the Source table name field, enter a single table name or a range of tables for which you want to crean the shadow tables.
Select the Clear shadow table content checkbox.
In the Cutover date field, enter the date before which shadow table records should be deleted.
Click Execute to apply the changes.