cancel
Showing results for 
Search instead for 
Did you mean: 

SAP CAP Report List Page - How to trigger GO button in the codes?

CJN
Discoverer
0 Kudos

Hi experts, 

I have an CAP application, and I have implemented the following logic by it:
1. on the list report page, enter some Filters: a,b,c, then click "GO" button
2. based on filters that I entered, I call an external service to retrieve some data and then write these data to CAP temp database during the test
3. Now I got issue, after clicking "GO" button on step 1, step 2 will be implemented and data will be stored successfully, BUT not displayed immediately on the UI list. If I click "GO" button again, these stored new data will be displayed. So, in total, I have to click "GO" button twice to refresh and display the data. 

Some of my ideas are: a) resend the ODATA Batch request to the server (as I see every time I click "GO", a batch request will be sent.) I have tried this with basic auth (my SID and password), but always get 401, have no idea how to deal with this. 
b) auto refresh the page or rebind the table after clicking go and storing the data, I have tried with extension API on controller, but it did not work. 

So I would like to ask if there are some solutions for this. 

Thanks!

 

Dinu
Active Participant
0 Kudos
I think you should look at correcting the behavior of your service rather than looking at how to press GO button. Whether you choose to cache the results or not should not affect the results of the query from UI. You should return the results from the external call, then the results should appear on the UI.

Accepted Solutions (0)

Answers (1)

Answers (1)

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert

Hi @CJN ,

After you do all the stuff you've implemented on step 2, call method 'refresh' on the odata model:

https://sapui5.hana.ondemand.com/sdk/#/api/sap.ui.model.odata.ODataModel%23methods/refresh

Depending on how you have bound your data model to your view (one-way or two-way) your UI will get the updated data after its bound model gets refreshed. Please review the following links:

https://sapui5.hana.ondemand.com/sdk/#/topic/68b9644a253741e8a4b9e4279a35c247

https://sapui5.hana.ondemand.com/sdk/#/topic/c72b922fdb59422496661000165d7ff1

https://sapui5.hana.ondemand.com/sdk/#/api/sap.ui.model.Model%23methods/setDefaultBindingMode

Best regards,
Ivan

CJN
Discoverer
0 Kudos
Thanks for the suggestions.