OOPS! Type of key field cannot be automatically split!

Table of contents

No heading

No headings in the article.

While working with a card that consists of a header and lines, I encountered a frustrating error today. Although I had previously solved this issue through trial and error, I found myself facing it again. In this article, we will explore the scenario leading to the error and discuss the solution.

Scenario: The error occurs when attempting to insert a new record into the line table from a list part. Specifically, if you have a key structured in the lines table as follows:

key(Key1; "Document No.", "My key 2", "Shortcut Dimension 1 Code", "Shortcut Dimension 2 Code","My last code Key")
{
}

Error Description: Upon encountering this issue, the following error message is displayed: "The code type of the key field cannot be automatically split." It indicates that the system does not support the automatic splitting of the code type for the key field, leading to the error.

Supported Data Types for Auto Split Property: To resolve this error, the system permits the following data types for the last key field to enable the auto split property: BigInteger Data Type, GUID Data Type, or Decimal Data Type field.

Solution: After struggling with the error for an hour and a half, I discovered that adding the last key as an integer allowed me to proceed with my work without any further hindrance.

key(Key1; "Document No.", "My key 2", "Shortcut Dimension 1 Code", "Shortcut Dimension 2 Code","My last Integer Key")
{
}