Hello,
Can we use EML to create/update business partners? I looked at I_BUSINESSPARTNERTP_3, but somehow have not been able to get it working in S/4 Hana Cloud.
I have a Fiori app, that selects business partners from I_BUSINESSPARTNER and a custom button to update the last name of the selected partner. So, I have a base CDS on top of I_BUSINESSPARTNER, a root view entity and a projection view. Created the behavior definition for root and projection view with an action and implemented the behavior in the class.
In my action method, I wrote the logic using READ ENTITIES/ MODIFY ENTITIES. The READ works, but the MODIFY fails. I am not sure if this is the right way to do it and do we need COMMIT ENTITIES (mentioned in the documentation)?
READ ENTITIES OF ZIT_BUPA2_CONSMP_VIEW IN LOCAL MODE ENTITY bupa ALL FIELDS
WITH CORRESPONDING #( keys )
RESULT DATA(partner) FAILED DATA(ls_failed) REPORTED DATA(ls_reported).
LOOP AT partner ASSIGNING FIELD-SYMBOL(<new_partner>).
<new_partner>-lastname = <new_partner>-lastname && '_test'.
MODIFY ENTITY i_businesspartnertp_3
UPDATE FROM VALUE #( ( VALUE #(
%data-lastname = <new_partner>-lastname
%control-lastname = cl_abap_behv=>flag_changed
%is_draft = if_abap_behv=>mk-off
%tky = CORRESPONDING #( <new_partner>-%tky )
) ) ) REPORTED DATA(modify_reported) FAILED DATA(modify_failed).
EXIT.
ENDLOOP.
Any help is appreciated!