on ‎2022 Jul 29 1:09 PM
Hello,
I am trying to modify the field "leagueuuid" which is an external key, here is what my table looks like :

Here is my code in my xml View :
<Input id="idlicence" width="27%"></Input>
<ComboBox id="_IDMultiComboBox4-3" change="GetPersonalInformation" editable="true" items="{/ZC_KEL_TRI_LIGUE_F02}" enabled="true" width="242px" valueState="None" maxWidth="100%">
<items>
<core:Item id="_IDItem4-3-1" text="{LigueName}" enabled="true" key="{LigueId}"/>
</items>
</ComboBox>
Here is my code in my controller :
( I was inspired by this blog to implement the following function CRUD operations on Employee profile using SAP UI5 | SAP Blogs )
handleWizardSubmit: function () {
var LicenceId = this.byId("idlicence").getValue();
var League = this.byId("_IDMultiComboBox4-3").getSelectedKey();
this.getOwnerComponent().getModel().read("/Licence", {
success: function (oData, oResponse) {
for (var i = 0; i < oData.results.length; i++) {
if ( oData.results[i].LicenceId === LicenceId ) {
var LicenceUuidFront = oData.results[i].LicenceUuid
var payLoad = { "Leagueuuid": League, };
this.getOwnerComponent().getModel().update("/Licence('" + LicenceUuidFront + "')",
payLoad, { method: "PUT",
success: function (odata, Response) {
if (odata !== "" || odata !== undefined) {
MessageToast.show("Upadte successful");
} else {
MessageToast.show("Update unsuccessful"); }
}, error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.responseText); }
}); } }
}.bind(this),
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.responseText);
}.bind(this) }); },
Here is what my Metadata file looks like :


I don't know where the problem comes from or how to solve it.
Request clarification before answering.
LicenceUuid1 I don't see this variable is defined in your code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't think you can change key of an entity if I am not wrong.
| User | Count |
|---|---|
| 9 | |
| 7 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.