cancel
Showing results for 
Search instead for 
Did you mean: 

Triggers in HANA in SAPABAP1-ERP-Tables gives issues to the running of ERP System

regysm21
Active Participant
0 Kudos

Hi Experts,


I created recently some triggers in the SAP HANA DB, more specifically in the SAPABAP1-Schema so that I capture automatically the changes that happen to the productive SAP ERP-Tables. The issues that I encountered was that the trigger was working correctly, but then the SAP System was generating a lot of errors for the Transaction-Codes and its Tables where the triggers were created. I haven't changed anything in the actual sap erp tables(where the trigger looks for changes). I have created a copy of those tables in the same schema SAPABAP1. After I deleted the triggers from the SAPABAP1-Schema, then everything was working fine from the ERP side.

Is this issue a common one? Can I create triggers on SAPABAP1-Schema to capture changes in the ERP Tables directly in the hana db? If not, then, is it possible to create triggers and its tables in another HANA-Schema and with it to capture the changes that happen in the SAPABAP1 (Schema)? I tried to create in another schema the Trigger and also the Copy of the orginial ERP-Tables where the changes would be stored, and the system did not allow me.

Best Regards,

Regys

andreas_baldauf
Active Participant
0 Kudos

Hi Regys,

Could you please provide more information?
- For which tables have you defined triggers?
- Could you attach the CREATE TRIGGER statements?
- Which errors have been generated?
- Could you attach one or more dumps?

You have also mentioned that you have created copies of ERP tables where the changes are logged.

- How do you ensure that the definitions of the original SAP tables and the definitions of your copies are always in sync.
- How do handle multiple updates of one entry on the original ERP table?
- Why do you have to log the changes with triggers? Are you aware of the SAP change documents (tables CDHDR, CDPOS)?

Best regards,
Andreas

regysm21
Active Participant
0 Kudos

Hi Andreas,

thanks a lot for the response. What I realised was that the error happens only with the update trigger. With the insert trigger seems no error to be generated at the ERP-Side. I am trying to trace the delta changes in a SAP ERP-Table called PROJ.

The following is the error that is generated at the SAP ERP-side when I perform an update:

It says the update was terminated and then generates the following error in ST22. I also checked the SM13, SM14 but not lot of informations were shown there.

I tried to find some SAP Notes about the above error: CJVB_PROJ_POST but none of them was at the point.

Regarding your questions:

1.As long as the tables are mainly SAP-Standard Tables, we assume that not a lot of structural changes

2. As long as the triggers are set on the ERP-Tables and the parallel functionality is there assured, we assume that the trigger tables also work.

3. We decided to avoid the CDPOS and CDHDR because of the joins that have to be done there and the big amount that we are processing.

The following is the script to the Update-Trigger:

<strong>create</strong> trigger SAPABAP1.UPDATE_DELTA_PROJ

after update
on SAPABAP1.PROJ

REFERENCING
OLD ROW ROW_OLD,
NEW ROW ROW_NEW
FOR EACH ROW
begin 
insert into SAPABAP1.ZPROJ_TRG_CCV VALUES (
:row_new.MANDT,
:row_new.PSPNR,
...
current_timestamp,
current_user);
end;

Do you perhaps have any suggestion about this issue? Is this a general issue when setting update triggers in SAPABAP1-Schema/Tables or perhaps I am doing something wrong?


Best regards,

Regys

regysm21
Active Participant
0 Kudos

Hi experts,

any update on this issue please?

Regards,

Regys

regysm21
Active Participant
0 Kudos

Hi Andreas,

that was exactly what was going wrong. Because I was inserting a new row in the Trigger-Table for the insert trigger and also for the update trigger, because of the duplicate key, the update trigger was not able to store records on the Trigger-Table. Therefore it was giving the error.

If you can convert you comment to an answer, then I can mark this question also as answered.

Best Regards,

Regys

Accepted Solutions (1)

Accepted Solutions (1)

andreas_baldauf
Active Participant
0 Kudos

Hi Regys,

You mentioned that table ZPROJ_TRG_CCV is copy of table PROJ (with 2 additional fields for CURRENT_TIMESTAMP and CURRENT_USER).

Please ensure that table ZPROJ_TRG_CCV has no primary key and no secondary unique index and that all columns of PROJ and ZPROJ_TRG_CCV have the same type and length.

In addition, please check if the INSERT statement of the trigger specifies all columns in the correct sequence.

You should also check the system log (SM21), the work process trace file (SM50) and the HANA diagnosis files (DB02). Maybe, you can find additional information about the error there.

Best regards
Andreas

Answers (0)