2207977 - Editing an MDF Object results in error "change is not allowed during Insert operation!. ."

SAP Knowledge Base Article - Public

2207977 - Editing an MDF Object results in error "change is not allowed during Insert operation!. ."

Symptom

  • Cannot edit external Code field during the insert/upsert operation.
  • Unable to edit data for the external code field in the MDF object while creating a new effective dated record.

Environment

  • SuccessFactors Cloud HCM: MDF
  • SuccessFactors Cloud HCM: EC MDF Object

Reproducing the Issue

Step 1:

  1. Create a user-based Effective Dated MDF Object

        2207977_4.PNG

 

       2. Create another MDF object and assign it as a child with Composite Association to the previously created object

       3. In the child MDF object, use the standard field: externalCode to store data of type String. Add the other fields of your choice for storing the data

 

       2207977_2.PNG       

 

Step 2:

  1. Create data for a user on the above MDF object with a effective start date via the Manage Data section
  2. Add data for all the required fields
  3. Click on Save

Step 3:

  1. Go to Manage Data and choose the already existing instance of this object for a user
  2. Insert a new record for this object by choosing a different Effective Date
  3. Try editing the data in the existing fields where one of the fields being edited is externalCode field and click on Save.
  4. You will get an error as highlighted in the below screenshot (screenshot 1)

OR 

  1. Go to Employee Files and access the MDF Object Portlet that is available for any sample user
  2. Click on Edit and choose a different effective date.
  3. Try editing the data in the existing fields and click on Save.
  4. You will get an error as highlighted in the below screenshot (screenshot 2)

(In the second scenario described above, choosing a different effective date during the Edit operation means the system expects that there is already a record available for the chosen date. Hence when the system fails to find any record for the selected date, it understands that you are inserting a new record and hence the corresponding error)

       2207977_3.PNG

       2207977_1.PNG

Cause

The above error occurs since the child MDF Object is using the externalCode field as any other standard or custom field that can be used to save the different data in the MDF Objects. Since the externalCode field plays the role of a Primary Key field for an MDF Object, changing its data each time while adding a new record for different effective date results in error. This is because, each time when the instance of an MDF Object is modified or added, the system will update the changes for the corresponding MDF Object's instance by searching for the relevant primary key value to update that entry on the data table. Therefore, editing externalCode field's data each time when new records for different effective dates are added, the system will not be successful in matching the primary key on the data table which is required to identify and update the corresponding instance of that MDF Object.

Resolution

externalCode field should be used only to store values that will not change each time a new effective dated record is added. For example: for a user-based MDF object this field acts as a primary key field with datatype as User, which will not be allowed to change during the insert operation. In the same way, for a non-user based MDF Object, it is recommended not to use this field to store any data that is expected to be changed each time a new record for different effective dates are added.

Keywords

  • MDF: Metadata Framework
, KBA , LOD-SF-FWK-MDF , MDF Framework , LOD-SF-EC-MDF , MDF & EC2MDF Migration , Problem

Product

SAP SuccessFactors HCM Core all versions