on 06-26-2023 5:53 PM
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!
Hey Indu - One more thing I noticed is that the ABAP EML statement MODIFY ENTITY used by you is inside the loop.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tanmay,
In the blog that I mentioned, the MODIFY is outside the loop. I had tried this way and it did not work as well.
I then moved the MODIFY inside the LOOP, as seen in the documentation of the object.
I don't think the MODIFY inside/outside the LOOP does not matter as I might be missing something else here.
User | Count |
---|---|
98 | |
8 | |
7 | |
6 | |
3 | |
3 | |
3 | |
3 | |
2 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.