cancel
Showing results for 
Search instead for 
Did you mean: 

UI5 Ajax Request to GW Service

Former Member
0 Kudos

Im trying to store some data to my created GW service which is bind to a RFC FM.

But i get a 500 internal error.


GET http://<host>:<port>/sap/opu/odata/sap/ZMOBILE_SRV_01/Protokolle?IvPspnrS=P-4433&IvPosidS=P-4433&IvTcode=SE13&IvBeschr=test&_=1410368050273 500 (Internal Server Error)


var oParameters= {

           "IvPspnrJ" : "P-4433",

           "IvPspidJ": "P-4433",

           "IvPspnrS": "P-4433",

           "IvPosidS": "P-4433",

           "IvTcode": "SE13",

           "IvBeschr": "test"

         };

$.ajax({

           url : "/sap/opu/odata/sap/ZMOBILE_SRV_01/Protokolle",

           contentType : "application/json",

           dataType : 'json',

           data: oParameters,

           success : function(data, textStatus, jqXHR) {

             alert("success");

           }

         });

In the SAP Netweaver Gateway Client i can create these values so the service is running correctly. Is the call to the service wrong ?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

My proceed was wrong i tried to use Ajax but im working with an OData service.

i have to use the OData model and its create function.

below is the new and working code:


var oModel = new sap.ui.model.odata.ODataModel("/sap/opu/odata/sap/ZMOBILE_SRV_01", false);

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

        

         var oEntry = {};

         oEntry.IvPspnrJ = "P-4433";

         oEntry.IvPspidJ = "P-4433";

         oEntry.IvPspnrS = "P-4433";

         oEntry.IvPosidS = "P-4433";

         oEntry.IvTcode = "SE19";

         oEntry.IvBeschr = "Test";

        

         //sap.ui.getCore().getModel().create('/Protokolle', oEntry, null, function(){

         oModel.create('/Protokolle', oEntry, null, function(){

             //sap.ui.getCore().getModel().refresh();

             alert("Create ok");

           },function(){

             alert("Create failed");

           }

         );

Answers (0)