cancel
Showing results for 
Search instead for 
Did you mean: 

Re: How to execute Function after save in RAP/Fiori Elements?

08-24-2022 9:45 AM
Marian_Zeis Active Contributor
4339 views 0 comments
SAP Managed Tags
Subscribe

Hello experts,

we have a Fiori Elements App with managed RAP and OData V4 and Draft (2021SPS01).

We would like to execute a function module (with 'COMMIT WORKS' in it) after every save in the Fiori App (Create/Update).

As far as I know, the following options are still before the commit or the data is persisted in the table.
So the function module can't access it yet.

We tried this so far:

"with additional save"
"determination method on save { create; update;}"

In both implementations, when we try so SELECT from the database, the newly created data is not yet commited.

Are there other alternatives in the RAP Framework?

In the Fiori Framework there is the event "attachAfterActivate", but apparently only in the V2 Framework?
What I have not tried yet, but what is also not ideal,attach to an event directly on the V4 model like createCompleted.

What options do we have here?

View Entire Topic
lutzi3
Active Participant

What about CALL FUNCTION IN UPDATE TASK ? The module is started in this case after commit work only. But it runs completely asynchronously you have to pass all values as parameters.

Sschlegel
SAP Champion
SAP Champion

Perhaps a "CALL FUNCTION DESTINATION 'NONE' IN UPDATE TASK" to be very sure 😄

This is probably the best idea. Better ideas might come with more info about what you want to do.

Marian_Zeis
Active Contributor

Hi lutzi3 and sschlegel ,

thank you for your answers.
We have also used exactly that:

CALL FUNCTION ''
STARTING NEW TASK 'UPDATE
DESTINATION 'NONE'.

Of course 'COMMIT' is used in the FM.
But I suspect with this, it is not waiting for the commit, because if i do a select in the commit, the DB is not yet updated.

With 'IN UPDATE TASK' it would probably wait for the commit, but that doesn't work together with 'DESTINATION NONE'.

Without 'DESTINATION' it dumps.