cancel
Showing results for 
Search instead for 
Did you mean: 

Performance check in SAPUI5 Custom App

former_member567509
Participant
0 Kudos

Hello Experts.

I created a custom SAPUI5 app and i want to see if the code is correct from performance perspective. So, i would really appreciate if you could suggest on below points

1. Is it fine to create local JSON models, bind them to UI controls and then link them to Odata models while making service calls to fetch data from backend?

2. Should we fetch the entire data required for say F4 helps in onInit() function or a call should be made when F4 is pressed and will it make call everytime F4 is pressed?

3. Is it fine to display say two different fragments performing different actions based on radio button by changing their visibility or it should be handled with 2 different views only?

4. My custom app currently used for create functionality and the entity is having 4 fields, now i have to add update functionality in the same app which will need more fields than required for create. Can i add more fields to the entity without effecting the existing create functionality?.

Thanks,

Accepted Solutions (0)

Answers (2)

Answers (2)

maheshpalavalli
Active Contributor
0 Kudos

1. Is it fine to create local JSON models, bind them to UI controls and then link them to Odata models while making service calls to fetch data from backend?

Yes that is fine, for update/create cases you can go for the json model approach, but i would recommend you to keep on eye on odata submit changes & odata v4 approach of using odata model to read/update/create instead of going for json explicitly..

2. Should we fetch the entire data required for say F4 helps in onInit() function or a call should be made when F4 is pressed and will it make call everytime F4 is pressed?

like srikanth mentioned, It is better to load the data on click of f4 help and show some sort of busy indicator while fetching the data and on second time dont fetch the data again..

There is even a better approach for this, create a CDS view( or a normal view depending on the complexity ) and you can bind it to the odata service entity by mapping method.. Then in your dpc_exit, you dont need to write the code, SADL layer will take care of the filters top skip etc.., So in the f4 help table if you bind this entity using growing as true, your f4 help performance will be in peaks..

3. Is it fine to display say two different fragments performing different actions based on radio button by changing their visibility or it should be handled with 2 different views only?

Yes fragments approach is fine, best approach is to buffer the two fragments in controller and based on the raddio button change event place the fragment in the content dynamically, so dom will not be overloaded, in this way you can achieve the best performance..

If you have very complex functionality or two independent functionalites or with routing then go for 2 views, i feel like yours is just radio button controlled visibility, so better go for fragments but make sure to do it based on the above approach

4. My custom app currently used for create functionality and the entity is having 4 fields, now i have to add update functionality in the same app which will need more fields than required for create. Can i add more fields to the entity without effecting the existing create functionality?.

Update the entityset with more fields . It will not affect the the create functionality even if you dont pass any values to it and make it nullable in odata service properties..


Thanks & Best Regards,
Mahesh

former_member567509
Participant
0 Kudos

Thanks for your answer, Mahesh. I would appreciate if you could provide more clarity on below.

2. How to avoid fetching data again?

3. I did it using radio buttons but will implement the dynamic loading of fragments. Now i have to add change and delete functionalities and i think i should go for 2 new views. In first view i am using Object Page Header control and put the radio button there and two fragments belonged to same view so the header part with radio buttons and cancel/save button was available. Now if i implement change/delete options with new view how will i handle it with other 2 radio buttons in first view. do i need to add those buttons again in new views ?

Or do you think i shall just 2 more fragments for change and delete and handle the functionality with IF condition on radio buttons in Controller?

Note: Few fields in different fragments will have same events and data model attached to them. I would really appreciate your help Mahesh.

Please advise.

Regards,

Deepak

former_member365727
Active Contributor
0 Kudos
  1. Local JSON models can be used
  2. For better performance call the service on click of F4 (lazy loading)
  3. Change visibility of fragments
  4. If you add more fields to the entity set then for create operation you need to pass all the fields even if values are empty

Refer to documentation Optimizing UI5 Applications

former_member567509
Participant
0 Kudos

Thanks for your comment Srikanth.

1. No impact on performance if i use local Json models or bind odata models?

2. In that case will it not make calls to backend everytime i press F4 and would that not affect performance?

4. How does standard app like Sales Order handles Create, Update and Deleted functionality. do we have separate apps for three operations. if it is a single app then are they passing empty values to the fields not needed during create operation?