SAP Knowledge Base Article - Public

2716682 - Instance Sync: Document Generation Sync completed with errors

Symptom

When performing an Instance Sync between a source and destination instance for Document Generation Templates, the job completes with errors. When reviewing the response you see something similar to the following -:

The following validation error occurred:For entity [Document Generation Template.Template ID : 12345, MappingDocument.mappingDocumentId : 12346, MappingToken.externalCode : 12347, externalCode : 12348, Document Generation Template.Effective Start Date : 01/01/2018 ] related to parent via path : mappingDocuments.mappingTokens.baseObjMappingTokenMeta encountered error - 1. You are not allowed to enter the value for the field externalCode with the type Auto Number in the object MappingTokenMeta to prevent data corruption. The value for this field type is always set by the system.

Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental. 

Environment

  • SAP SuccessFactors Employee Central
  • Document Generation

Reproducing the Issue

Perform an Instance Sync on Document Generation Template data.

Cause

This is currently expected behavour. Since the 1805 release you are no longer able to synchronize Document Generation Templates, as some of the Child Objects use the Auto-Number feature in MDF. And since 1805 you can no longer override the Auto-Number value with a value provided in the import file (and this also includes Instance Sync).

Resolution

Currently the solution is to export the Document Generation Template (and dependent data) from the Source instance and import the ZIP file into the Destination instance. This is not as straight forward as just export and import, and some manual steps must be followed. Please ensure you read the information below carefully, and plan to test this with 1 template first before doing any major loads.

While importing MDF objects that have auto-number fields, you can replace the values of such fields in the csv with either a blank value or a placeholder value which is basically # followed by a number (eg: #45678).

  • BLANK: When blank value is used, the system automatically replaces it with the next number from the auto-number sequence.
  • PLACEHOLDER: When a placeholder value is used, it works the same but it also tries to maintain the relationship between grandparent, parent and child objects.

When performing such actions with MDF objects with a single level of child objects (parent-child), a blank value should be enough for the autonumber external code fields to be correctly filled by the system.

However, when you are working with MDF objects that have multiple layers of child objects like in the case of DocumentGenerationTemplate (Grandparent-parent-child-subchild ...), the placeholder values are necessary for the auto-number external code fields. It is necessary because it is the only way to maintain the relationship between the objects across each layer (Grandparent - parent, parent - child, child - subchild, ....).

To use the placeholder value, you must replace the existing value in the autonumber fields with # followed by a number (eg: #1876). This number has to be unique within the context of that import. This is because it must be reused in the parent external code fields within the other csv files of the child and grandchild objects. This makes it clear to which parent or grandparent object the child is related to.

Our recommendation in this scenario would be to not come up with any numbers of your own. The exported zip or csv files from the source instance should have the autonumber external code fields of the child objects already filled with some numbers. These are the numbers the system generated when these objects were created in the source instance. This means that they are already filled in such a way that the relationship between the grandparent, parent, child etc objects are maintained properly across all the csv files. The only thing you have to do is to add a # in front of these values. So, in other words the only thing you have to do after export is to add a # in front of the values for all the fields which are autonumber external code fields.

Please also ensure that the files are imported in zip format. As the Export (including dependents) will export in ZIP format, you can use the same ZIP file and contents for the import. This way, all the csv files of the grandparent, parent, child etc objects are imported together and the relationship is not lost.

 

Summarised Steps

Exporting and manually adjusting the data

  1. Export the Document Generation Template (including dependencies) in zip file format from the source instance,
  2. Extract the zip file completely.
  3. Add a '#' to the values of all the autonumber fields in the csv files of the child objects. In the case of DocumentGenerationTemplate these are the columns and the corresponding csv files:

 

Column(s) that require a leading # CSV Import File
* mappingDocuments.mappingDocumentId Document Generation Template-mappingDocuments.csv

* mappingDocuments.mappingDocumentId
* mappingDocuments.mappingTokens.externalCode

MappingDocument-mappingTokens.csv
* mappingDocuments.mappingDocumentId
* mappingDocuments.mappingTokens.externalCode
* mappingDocuments.mappingTokens.baseObjMappingTokenMeta.externalCode
MappingToken-baseObjMappingTokenMeta.csv
* mappingDocuments.mappingDocumentId
* mappingDocuments.mappingTokens.externalCode
* mappingDocuments.mappingTokens.elementNameMappingTokenMeta.externalCode
MappingToken-elementNameMappingTokenMeta.csv
* mappingDocuments.mappingDocumentId
* mappingDocuments.mappingTokens.externalCode
* mappingDocuments.mappingTokens.ruleIdMappingTokenMeta.externalCode
MappingToken-ruleIdMappingTokenMeta.csv

 

Preparing for import

  1. Re-zip all the files which were extracted in step 3, including the import.properties file.
  2. Import the new zip file into the destination system.

 

SPECIAL NOTE: If something goes wrong with the import (for example if it fails due to a data issue/validation error), please do not try to re-import such a zip file more than once, as this can lead to re-creation of the child objects by insertion rather than updation. In other words, new child objects will be created instead of updating the already imported/existing ones.

We strongly advise against doing this due to the high likelyhood that duplicate data is created. Instead you must perform an additional export in the Destination instance, and using the "DocumentGenerationTemplate" object, DELETE (using the operation column) the already imported templates before using the ZIP import file to re-importing them once again.

Keywords

In attribute requires non-null value, ECT-107762, instance sync, document generation, You are not allowed to enter the value for the field externalCode with the type Auto Number in the object MappingTokenMeta to prevent data corruption. The value for this field type is always set by the system, ec, XAF-20659 ,Validation of AutoNumber fields in Import Controller, Import, Export, Template, Mapping, KM-7895 , KBA , LOD-SF-EC-DOC , Document Generation , How To

Product

SAP SuccessFactors Employee Central all versions ; SAP SuccessFactors HCM Core all versions