on 07-30-2013 6:48 PM
Hi, I'm trying to learn how to interact with the Function Imports of a gateway service. I can't find any documentation about it. Does anyone have an example I can look at?
I've been playing around with CheckFlightAvailability on RMTSAMPLEFLIGHT.
If you have code on how to trigger it and retrieve the data, that would be great!
Hi Ryan,
here a simple example to trigger the action "GetAvailableFlights". In my example, this action has the HttpMethod GET attached. Therefore you have the possibility to test this simply in your browser by appending the following string to the service URL:
GetAvailableFlights?fromdate=datetime'2012-03-01T00:00'&todate=datetime'2012-04-01T00:00'&cityfrom='NEW%20YORK'&cityto='SAN%20FRANCISCO'
Alternatively you can use the read method of the model like this:
searchFlights: function(oEvent){
sap.ui.getCore().getModel().read(
"GetAvailableFlights",
null,
[
"fromdate=datetime'"+oAvailableFlightsController.formatDateUrl(sap.ui.getCore().byId("inpFromDate").getYyyymmdd())+"T00:00'",
"todate=datetime'"+oAvailableFlightsController.formatDateUrl(sap.ui.getCore().byId("inpToDate").getYyyymmdd())+"T00:00'",
"cityfrom='"+sap.ui.getCore().byId("inpCityFrom").getValue()+"'",
"cityto='"+sap.ui.getCore().byId("inpCityTo").getValue()+"'"
],
true,
function(oData, oResponse){
console.log("Success!");
console.log(oResponse);
console.log(oData);
},
function(oError){
console.log("Error!");
console.log(oError);
}
);
},
And for the CheckFlightAvailability, the URL could look like:
CheckFlightAvailability?airlineid='AA'&connectionid='0017'&flightdate=datetime'2012-02-22T00:00'
Regards, Frank
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello.
You can use jQuery.ajax to perform a HTTP GET or POST.
The only problem is that to call a Function Import in this way you must set a XCSFR token inside the HTTP header.
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.