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.
Hello Indumati,
May I know where are you writing the ABAP EML MODIFY ENTITY statement? As per documentation, ABAP EML MODIFY statements must not be used in the RAP Saver methods - check_before_save, adjust_numbers, save, save_modified. The ABAP EML MODIFY statements can be used only in the RAP interaction phase and in the finalize saver method in the RAP save sequence.
Try this out!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tanmoy,
I have an action and the MODIFY is written in the behavior implementation for the action method.
The approach is similar to the one mentioned in this blog.
User | Count |
---|---|
108 | |
14 | |
10 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.