cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP RAP - UI refresh after static action call

emalelez
Explorer
893

Hi all,

I defined a static action in un unmanaged RAP FIORI List Report application. The app is completely standard apart from the custom static action.

The static action creates a new instance for the entity (just a new record in the table zcrmm013_servizi that has 3 columns). The ABAP statements works well but after the action call no UI refresh is performed.

Here after the action defintion in BDEF:

static action AzStatica parameter ZC_CRMM013_SRV_PAR_CRZ result [1..*] $self;

Here after the action implementation:

METHOD AzStatica.

    DATA(ls_keys) = VALUE #( keys[ 1 ] ).

    DATA: ls_zcrmm013_servizi TYPE zcrmm013_servizi.

    ls_zcrmm013_servizi = VALUE #( servizio = ls_keys-%param-servizio
                                   quantita = ls_keys-%param-quantita
                                   meins = ls_keys-%param-meins ).
    INSERT INTO zcrmm013_servizi VALUES ls_zcrmm013_servizi.

    result = VALUE #( ( %cid = keys[ 1 ]-%cid
                        %param   = VALUE #( servizio = ls_zcrmm013_servizi-servizio
                                            quantita = ls_zcrmm013_servizi-quantita
                                            meins = ls_zcrmm013_servizi-meins ) ) ).

  ENDMETHOD.

I noticed that if the action result cardinality is set to [1] then the object page is opened after the action call and new data is visibile in the object page. When exiting the object page, the record list is automatically refreshed in the main page and the new record is visibile too. Otherwise, if result cardinality is set to something different from [1], e.g. [1...*], the object page is not opened but the record list in the main page is not refreshed.

I'd like not to enter the objet page and to have the record list updated.

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos

Can you please provide a few more details such as the ABAP Platform release that you are working on?

emalelez
Explorer
0 Kudos

Hi Andre, thank you for your reply.

I'm working on an S/4HANA on premise system:

emalelez
Explorer
0 Kudos

Hi andre.fischer,

have you any idea?

Thanks in advance.

View Entire Topic
mlewis
Explorer

Hi I have a similar scenario - I would like to have a static factory action to create multiple instances and simply refresh the List Report list.

If I have cardinality [1] it tries to display object page but is empty. when I change to [1..*] no object page which is what is required but list does not refresh.

s/4 Hana on premice 2020 SP02.

@Andre_Fischer - any suggestions? I thought perhaps a Side Effect annotation but guided development doesn't help

Many thanks

Mark

rammel_sapdev
Participant
0 Kudos
You can use the SideEffects to trigger a refresh of entity based on action. This worked for me.
Shahab2
Explorer
0 Kudos
Thanks Rammel.. do you please have a reference code, so I can refer.
Ladeiro
Advisor
Advisor
0 Kudos

SideEffects might help for this purpose.
Check the documentation here https://help.sap.com/docs/abap-cloud/abap-rap/side-effects

or 

the existing demo object DEMO_RAP_SIDE_EFFECTS:

 

managed implementation in class bp_demo_rap_side_effects unique;
...
{

...
action MyAction;
...

side effects{
...
// Side effect for refreshing data of an entity
action MyAction affects field char_field, entity_Assoc;
}
}