cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAPUI5 - Server error 405 (Method Not Allowed) while creating new entry in OData V2 model

0 Likes
6,396

Dear experts,

I am currently trying to create a new entry in my OData V2 model using the below code:

//Create entry:
oSubmitModel.createEntry(sPathToMyEntitySet, {properties: oMyNewObject});
//Submit changes to the Model:
oSubmitModel.submitChanges({
 success: function () {
     MessageToast.show("Material created.");
     //Resfreh Model:
     oSubmitModel.refresh(true);
 },
 error: function (oError) {
     MessageToast.show("An error occured during changes submitting. Material has not been created.");
     console.log("Error:", oError);
     //Reset to previous state (before changes) and resfreh Model:
     oSubmitModel.resetChanges();
     oSubmitModel.refresh(true);
 }
});<br>

The code above results in the following error:

I think this is caused by the fact that I did not use GroupIDs for the $batch operation but I can't find a way to do it.

How could I post some new entries on a remote OData V2 Service?

Thank you,

F.

Accepted Solutions (1)

Accepted Solutions (1)

david_bizer
Product and Topic Expert
Product and Topic Expert

Is the resource you are trying to perform a create on configured to allow HTTP Posts? This has to be set in the oData service. The error message could be because of the resource you are trying to create is read-only (GET). You could f.e. check SEGW for the CRUD flags.

Answers (0)