cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 - POST: HTTP request failed500

Former Member
0 Kudos

Hey together,

I've build a simple App for reset the user password. But I get back a 500 Error:

The following problem occurred: HTTP request failed500

The Logs:

/IWBEP/ERROR_LOG and /IWFND/ERROR_LOG dont show an error.

With the SAP Gateway Client the URL: /sap/opu/odata/IWBEP/USERREQUESTMANAGEMENT/ResetUserCredential?UserName='USER'

works with POST.

My Code:

sap.ui.define([
	"sap/ui/core/mvc/Controller",
	"sap/m/MessageBox"
], function (Controller, MessageBox) {
	"use strict";
	return Controller.extend("??????.controller.MainView", {

			onInit: function () {

			var oView = this.getView();
			var sServiceUrl = "/sap/opu/odata/IWBEP/USERREQUESTMANAGEMENT/";
			var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, false);
			this.getView().setModel(oModel);
		},

		pressAbsenden: function (oEvent) {

			var oView = this.getView();
			var oId = oView.byId("anln1").getValue();
			var oModel = this.getView().getModel();

			sap.ui.getCore().setModel(oModel);

			oModel.create("/ResetUserCredential?UserName='" + oId + "'", null, function (response) {
				MessageBox.confirm("Erfolgreich");
			}, function (Error) {
				MessageBox.error("Error");
			});
		}
	});
});

Thanks for helping

regards

Accepted Solutions (0)

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos

i don't think it is "normal" way to call create function

Former Member
0 Kudos

And what is the "normal" way?

junwu
Active Contributor
0 Kudos

just look a the create method, not other thing in that blog.

https://blogs.sap.com/2019/05/07/crud-operations-on-employee-profile-using-sap-ui5/

this.getOwnerComponent().getModel().create("/EmpSet", payLoad, {
				success: function (odata, Response) {

					if (odata !== "" || odata !== undefined) {
						MessageBox.success("Created successfully.");
					} else {
						MessageBox.error("New entry not created.");
					}
				},
				error: function (cc, vv) {

				}
			});