Mentor SAP

The EML Principle

Entity Manipulation Language (EML)

 

Entity Manipulation Language (EML) is a part of the ABAP language that is used to control the business object's behavior in the context of ABAP

 

The ABAP EML is a subset of ABAP for accessing RAP business objects (RAP BOs). EML statements allow the data content of a RAP BO (transactional buffer) to be read or modified and the persistent storage of modified data to be triggered.

 

ABAP EML can be used in all ABAP programs to consume RAP BOs. In particular, they can be used in the implementation of a RAP BO in a behavior implementation (ABAP behavior pool) itself. For the latter, there are some special EML variants.

 

The execution of an EML statement triggers processes in the RAP runtime framework that call the implementation of the RAP BOs. For unmanaged RAP BOs or unmanaged parts of managed RAP BOs, the implementation is part of an ABAP behavior pool. Otherwise, it is part of the RAP provider framework.

 

The operands of EML statements are mainly special data objects for passing data to and receiving results or messages from RAP BOs. These data objects are structures and internal tables whose types are tailor-made for this purpose and derived from the RAP BO definition, namely the involved CDS views and behavior definitions.

 

 

The example for EML shows the creation of one or several new instances of RAP Business Object d437_i_text. This RAP BO consists of only one entity (root entity). The name of the root entity is also d437_i_text.

 

The actual creation of the new RAP BO instances takes place in EML statement MODIFY ENTITY, where d437_i_text specifies the (root) entity of the BO. The input for the create statement is provided by placing ABAP data object gt_text after addition WITH. (To simplify the example, we omitted the coding to fill internal table gt_text).

 

ABAP data object gt_text is a good example of a derived data type. The DATA declaration uses the new syntax variant TYPE TABLE FOR, followed by a keyword to specify the purpose of the data object and the name of the RAP BO entity. In our case, the keyword is CREATE and the name of the entity is d437_i_text. As a result, data object gt_text is an internal table which is tailor-made for a create access to RAP BO entity d437_i_text.

 

The declaration of data object gs_text uses TYPE STRUCTURE FOR. It is not meant to be used in an EML statement, but rather as a work area for internal table gt_text.

 

Data objects gs_failed and gs_failed_late are also declared with derived data types. They belong to a group of derived types called response types. Response types are always structures. They depend on the RAP BO entity but not on a specific operation (Create, Update, Delete, and so on).

 

After the EML statement MODIFY, the changes are not sent to the database directly. The persistence of the data changes is triggered by EML statement COMMIT ENTITIES. There is also a statement ROLLBACK ENTITIES, which can be used to undo changes that are persisted if there are errors.

 

EML Commands

EML Commands - Overview

 

The figure, EML Commands - Overview, provides an overview of the most important EML commands, which are the basic operations Read, Create, Update, Delete, Execution Actions. Depending on the operation, the statement expects one or more internal tables as operands for input and output. The data types of these operands are derived data types that depend on the RAP BO entity and the individual operation.

 

Note the following: