cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ABAP RAP: Update Child entity from Parent entity with Action

lars_kr
Participant
2,564

Hello Community,

Is it possible to change the child entity with an action from the parent entity? Creating a new child entity works, but changing an existing one causes me problems.

Here is my EML:

MODIFY ENTITIES OF c_parent_entity IN LOCAL MODE
      ENTITY child_entity
          UPDATE FIELDS ( status )
             WITH VALUE #( FOR key IN keys
                         ( %tky       = key-%tky
                           status = task_status-closed ) )
        MAPPED mapped
        FAILED failed
        REPORTED reported.

 It doesn't seem to work that way.

 

regards,

Lars

Accepted Solutions (0)

Answers (2)

Answers (2)

MioYasutake
SAP Champion
SAP Champion

@lars_kr 

The key-%tky is the parent key. First, you need to retrieve the child entities associated with the parent and update them using their respective keys.

Tisha_Haria
Explorer
0 Likes

Try to set the control field as well like below and it should work:MODIFY ENTITIES OF c_parent_entity IN LOCAL MODE
ENTITY child_entity
UPDATE FIELDS ( status )
WITH VALUE #( FOR key IN keys
( %tky = key-%tky
status = task_status-closed
%control = VALUE #( status = if_abap_behv=>mk-on) ) )
MAPPED mapped
FAILED failed
REPORTED reported.