I am trying to validate IBAN in wizard in SAPUI5. To do this, I'm using functionImport
on V2 ODataModel
(sap.ui.model.odata.v2.ODataModel).
The request returned a 202 status code but actually failed. Here is the response (from the Firefox Network tab):
--1D57E7CB0DD73AB15048B36CC96993D60 Content-Type: multipart/mixed; boundary=1D57E7CB0DD73AB15048B36CC96993D61 Content-Length: 1303 --1D57E7CB0DD73AB15048B36CC96993D61 Content-Type: application/http Content-Length: 1134 content-transfer-encoding: binary HTTP/1.1 200 OK Content-Type: application/json Content-Length: 950 dataserviceversion: 1.0 cache-control: no-cache, no-store pragma: no-cache content-id: id-1687346500037-256 {"d":{"CheckIBAN":{"__metadata":{"type":"XXXX"},"AccountID":"XXXXXX","IBAN":"DEXXXX","BankID":"","WithInOutPayment":true,"SepaNotifText":"XXX"}}} --1D57E7CB0DD73AB15048B36CC96993D61-- --1D57E7CB0DD73AB15048B36CC96993D60 Content-Type: application/http Content-Length: 1111 content-transfer-encoding: binary HTTP/1.1 400 Bad Request Content-Type: application/json;charset=utf-8 Content-Length: 991 dataserviceversion: 1.0 {"error":{"code":"XXX/076","message":{"lang":"de","value":"XXX"},"innererror":{"application":{"component_id":"XXX","service_namespace":"XXX","service_id":"XXXX","service_version":"0001"},"transactionid":"XXX","timestamp":"XXX","Error_Resolution":{"SAP_Transaction":"XXX","SAP_Note":"XXXX"},"errordetails":[{"code":"XXX/076","message":"XXX","propertyref":"","severity":"error","target":""}]}}} --1D57E7CB0DD73AB15048B36CC96993D60--
(Remove all confidential content) This is the result in the browser console:
So it has to be registered somewhere. My code for registering callbacks is as follows:
this.SERVICE.functionImport("CheckIBAN", XXX.Constants.HTTP_POST, XXX, true, { fnSuccess: jQuery.proxy(function (oData) { fnCallback(oData); }, this), fnError: fnError });
Please note that the functionImport
function is just a wrapper around sap.ui.model.odata.v2.ODataModel.callFunction and performs the same operation.
No matter what I enter (correct or incorrect input), it always calls fnSuccess
.
When I use the read
function of ODataModel
(so just a simple GET
-request) everything works fine and when an error occurs a fnError is triggered
.
Your question does not contain the question "?"
I'm assuming you're asking why "error" isn't called?
If the http request fails, "error" is called. When you use batch processing, any errors in the changeSet will not be handled by this API...UI5 v2 is not a very elegant implementation...
See also: https://github.com/SAP/openui5/ISSUE/1382#issuecomment-288723906