cancel
Showing results for 
Search instead for 
Did you mean: 

Factory Action on multiple instances does not refresh list report

jheisler
Explorer
0 Kudos
200

Hi,
i have a fiori elements app based on the list report floorplan. It allows me to do CRUD operations on a custom table. I added a factory action that allows users to select multiple entries, enter the actions parameter "Year" and then all entries are being duplicated with the newly entered year.

The Problem: When doing this, the list report won´t update. I need to manually press "Go" to also have the newly created entries in the list.

factory action copyEntries parameter Z..._INPUT_copyEntries [1];

Implementation of the factory action:

METHOD copyEntries.
    DATA: create_duedates TYPE TABLE FOR CREATE z...\\DueDates.
    DATA(new_year) = VALUE #( keys[ 1 ]-%param-period_year OPTIONAL ).

    READ ENTITIES OF z... IN LOCAL MODE
        ENTITY DueDates
            ALL FIELDS WITH CORRESPONDING #( keys )
            RESULT DATA(r_duedates_to_copy)
            FAILED DATA(f_diedates_to_copy).

    create_duedates = VALUE #( FOR duedate IN r_duedates_to_copy
                                 ( %cid = keys[ %key-Companycode = duedate-Companycode
                                                %key-Period = duedate-Period
                                                %key-Periodyear = duedate-Periodyear
                                                %key-Type = duedate-Type ]-%cid
                                   %data = CORRESPONDING #( duedate MAPPING Periodyear = DEFAULT new_year ) ) ).

    MODIFY ENTITIES OF z... IN LOCAL MODE
        ENTITY DueDates
            CREATE FIELDS ( Companycode Duedate Period Periodyear Type )
            WITH create_duedates
            MAPPED mapped.
  ENDMETHOD.

 I already tried adding a side effect, but that did not change anything

  side effects {
    action copyEntries affects $self;
  }

Does anyone have an idea?

Technical background: S/4HANA OP 2023, minUI5 version 1.120.0

View Entire Topic
mainak-aich
Participant
0 Kudos

Hi @jheisler , 

1. You can follow the option 1 as mentioned by @ClearQueries by adding local annotation inside fiori project. That will surely work. Also, remember to empty cache and hard refresh in your browser to ensure the updated OData annotation is used by Fiori.

2. Ideally factory action should automatically refresh the LRP Fiori page. At least for me it works. Please check the demo CDS entity DEMO_RAP_FACTORY_ACTION to get more help. 

Thanks,

Mainak