ABAP Keyword Documentation → ABAP − Reference → ABAP RESTful Programming Model → Entity Manipulation Language
ABAP EML - CONVERT KEY
Other versions:
7.31 | 7.40 | 7.54
Syntax
COMMIT ENTITIES BEGIN
...
CONVERT KEY OF entity_name
FROM pre_key
TO key.
COMMIT ENTITIES END.
Effect
For entities with late numbering, the statement MODIFY provides only temporary keys. For these temporary keys, a successful save method draws finalized keys. If, for example, the keys of new instances are passed to a HTTP response, they must be the finalized values and not the temporary values from the MODIFY phase. The statement CONVERT KEY is used for this.
The statement CONVERT KEY may only be used in the context of a block-constructing variant of the statement COMMIT ENTITIES to determine the finalized value of a temporary key. In the context of the statement COMMIT ENTITIES, the runtime of the ABAP RESTful programming model holds its key registry to respond to queries from the statement CONVERT KEY. In the statement COMMIT ENTITIES END, this information is then deleted.
In its dynamic form, the statement CONVERT KEY is passed the name of the entity and does not perform a static type check.
Remarks
- Unlike the other EML statements, CONVERT KEY does not operate on tables. This is because the consumer typically iterates across the consumer’s own data and needs to fill specific columns. The preceding extraction of all pre_keys, following by a mass conversion and insertion of keys in the target table would be more time-consuming and use more resources than repeating the direct individual operation.
- Within a behavior implementation, the statement CONVERT KEY is permitted only in the SAVE method. If this rule is violated, the runtime error BEHAVIOR_ILLEGAL_STATEMENT occurs.