cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in the Master Detail Fiori application

former_member188396
Participant
0 Kudos

Hi,

I am using WebIDE to build our custom Fiori application based on the Master details template out there.

We are using SAPUI5 version 1.44.19.

everything works fine except one issue we have seen recently.

In our scenario, we are displaying list of addresses person/employee has in the system. When they select anyone, details are shown on the right hand side. Now, here they can edit or remove particular address.

For each record, primary key is:- pernr, address type, begin date & end date (as same employee can have multiple addresses based on the validity dates)

Removing works fine. Edit also works fine except one scenario.

When they edit, user can change the begin & end date of the record as well. (Which are primary keys)

When data is sent to backend, it updates the record successfully. Now, after update, application automatically makes 2 calls also.

1. Getting the list of employee addresses (calling the getEntitySet method in the ODATA)

2. getting the employee record for which update was made (calling the GetEntity method in the ODATA)

When it calls the 2nd item, obviously, it will fail as primary key (dates) were changed for that record.

I was trying to find out how can I avoid the second call so that it does not try to call updated record.

Any other suggestions?

-Bhavik

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member188396
Participant
0 Kudos

Hi A K,

1. We can't disable the dates as it is part of the functionality which they can change.

2. Right now, to update the data in the backend, we are sending the updated values in the payload only with old dates in the URL as primary keys. That works fine. Only issue is, once done updating, application automatically sends requests to get the updated data. ( I have even not coded to update it).

Now, do you mean, create another ODATA Model, call the service and update the data?

Below was the code on the Submit event to update to backend.

SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } .L1S33 { color: #009300; } .L1S50 { color: #00008B; }

var sPath = this.getModel().createKey("EmployeeAddressSet", {
Pernr : oJson.Pernr,
Subty : oJson.Subty,
Endda : this._oModelData.Endda,
Begda : this._oModelData.Begda
});

this.getModel().update("/" + sPath, oJson, {
refreshAfterChange: false,
success: function(oData, response) {
// Update the Json model again from the response
that.getModel("AddEditAddrView").setProperty("/busy", false);
that.getRouter().getTargets().display("editConfirm");
},
error: function fnError(oError) {
that.getModel("AddEditAddrView").setProperty("/busy", false);
},
async: true
});

As you see, I am not doing anything on the success event. Also, I have tried adding the "refreshAfterChange" parameter with value false. But, it did not help either.

Thanks,

Bhavik

karthikarjun
Active Contributor
0 Kudos

1) You can disable beginning date/end date fields in UI

2) If not, store the changed date locally-> while calling 2nd service insert the updated date as an argument