This article contains a growing list of EML statements samples.

READ

Read single records fetching given fields only

READ ENTITIES OF <bdef> IN LOCAL MODE
   ENTITY <entity/alias name>
   FIELDS ( field1 field2 fieldn )
   WITH VALUE #( ( %key = key-%tky ) )
   RESULT FINAL(entities).

FINAL(entity) = entities[ 1 ].						

Read multiple records with given fields

READ ENTITIES OF <bdef> IN LOCAL MODE
   ENTITY <entity/alias name>
   FIELDS ( field1 field2 fieldn )
   WITH CORRESPONDING #( keys )
   RESULT FINAL(entities).

Read different entities also addressing them by association in one shot

    READ ENTITIES OF <bdef> IN LOCAL MODE
         ENTITY <entityA>
         FIELDS ( field1 field2 fieldn )
         WITH CORRESPONDING #( keys )
         RESULT FINAL(entitiesA)
         ENTITY <entityA>
         BY \_<association_name>
         ALL FIELDS WITH CORRESPONDING #( keys )
         RESULT FINAL(entitiesB).

UPDATE

Update single record, setting with given fields only

MODIFY ENTITIES OF <bdef> IN LOCAL MODE
	   ENTITY <entity/alias name>
	   UPDATE FIELDS ( field1)
	   WITH VALUE #( ( %tky            = key-%tky
	                   field1          = <value> 
                           %control-field1 = if_abap_behv=>mk-on
) ).

Update multiple records with given fields only

    MODIFY ENTITIES OF <bdef> IN LOCAL MODE
           ENTITY <entity>
           UPDATE FIELDS ( field1 field2 fieldn)
           WITH VALUE #(
               FOR struc_var IN internal_table_var
               ( key_field  = struc_var-key_component
                 field1 = struc_var-component1
                 field2 = struc_var-component2
                 fieldn = struc_var-componentn
                 %control-field1 = if_abap_behv=>mk-on
                 %control-field2 = if_abap_behv=>mk-on
                 %control-field3 = if_abap_behv=>mk-on
  ) ).

CREATE

Entities and entities by parent association

    MODIFY ENTITIES OF <bdef>
           ENTITY <entityA> CREATE FROM <entityA_create_tab>
           ENTITY <entityA>
           CREATE BY \_<entityB_association> FROM <entityB_create_tab>           
           MAPPED   DATA(mapped)
           FAILED   DATA(failed)
           REPORTED DATA(reported).

Share this content: