Symptom
You may see an error similar to one of the following, although a different foreign key may be mentioned:
- The system could not update the record for one or more reasons: java.sql.SQLIntegrityConstraintViolationException: integrity constraint (FK_CMPL_STAT__TAP_DEF) violated - parent key not found
- The system could not add the record for one or more reasons: java.sql.SQLIntegrityConstraintViolationException: integrity constraint (FK_CMPL_STAT__TAP_DEF) violated - parent key not found
Environment
SAP SuccessFactors Learning
Reproducing the Issue
Import reference data, in this example the issue is with importing a completion status
- Go to System Admin > Tools > Import Data
- Choose Download Template, and then choose to download the template for References
- Go to the Completion Status tab in the excel template that was just downloaded
- Add records for any Completion Statuses you would like to update, or any new ones you would like to add
- Now go back to Import Data, this time choose Import Data instead of Download Template, References as the Record Type, Add and Update to the Import Option depending on the action you are performing, and choose the file you have just altered to import
- Submit the file, and then choose to run the job now
- At this point if the import fails you can go back to the Import Data to view failed jobs
- Download the Error Log and you should see the reason for the failed import in the Comment section beside each row that failed
Cause
- If you see a constraint violated - parent key not found error like in this example it is caused by a referenced field not pointing to a a valid existing object
- In the example above it is referencing the Approval Process column of the template
- This is a referenced field so it must point to an Approval Process ID that already exists
- Another example would be a violation of FK_CMPL_STAT_CPNT_TYPE which would mean the Item Type specified does not exist
Resolution
- To resolve this issue for required referenced fields make sure the ID that you put is a valid ID that already exists in the system
- To resolve the issue for a non-required field like the Approval Process column either enter a valid ID that already exists, or just leave the column blank
Keywords
SAP SF Learning LMS Integrity Constraint Violated with Import Data add update , KBA , LOD-SF-LMS-ADM , System Admin, Global Variables, References , LOD-SF-LMS-IMP , Import Data Tool , Problem
Product
SAP SuccessFactors Learning all versions